1、检查系统是否正常
more /var/log/messages(检查有无系统级错误信息)
dmesg (检查硬件设备是否有错误信息)
cat /proc/cpuinfo (检查 CPU 频率是否正常)
top (按 1 检测 CPU 核数是否正常,内存大小是否正常)
ifconfig(检查网卡设置是否正确)
ping www.baidu.com(检查网络是否正常)
2,关闭防火墙
systemctl stop firewalld
关闭selinux安全子系统 并设置参数
setenforce 0
可以使用getenforce检查是否关闭
vi /etc/selinux/config 修改第七行为permissive
3 ,yum源配置
新安装的虚拟机,当前需要先配置本地源才可以使用yum
创建一个挂载点 mkdir /opt/centos
可以将虚拟机镜像上传到虚拟机上面 然后mount -u 镜像路径 /opt/centos
然后vi /etc/yum.repos.d/local.repo
[centos]
name=centos
baseurl=file:///opt/centos
gpgcheck=0
enabled=1
然后
yum clean all 清空原有yum缓存ls
yum makecache 建立元数据
配置网络源yum
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
yum -y update 升级软件包
4,配置基础环境
4.基础开发环境
yum -y install ntp make openssl openssl-devel pcre pcre-devel libpng libpng-devel libtiff-devel libjpeg-6b libjpeg-devel-6b freetype freetype-devel gd gd-devel fontconfig-devel zlib zlib-devel libevent-devel gcc gcc-c++ flex bison bzip2-devel libXpmlibXpm-devel ncurses ncurses-devel libmcrypt libmcrypt-devel libxml2 libxml2-devel imake autoconf automake screen sysstat compat-libstdc+±33 curl curl-devel
安装nginx
yum -y install nginx
如果显示没有nginx就是可能没有安装扩展源
使用命令
sudo yum install epel-release
yum -y update
安装完毕就可以安装nginx
systemctl start nginx
ps -ef | grep nginx
netstat -tunlp | grep 80
nginx 动态站点部署
wget https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-8.0.20-linux-glibc2.12-x86_64.tar.xz
tar -xf mysql-8.0.20-linux-glibc2.12-x86_64.tar.xz
进入目录 cd mysql-8.0.20-linux-glibc2.12-x86_64
vim /etc/profile
export PATH=$PATH:/root/mysql-8.0.20-linux-glibc2.12-x86_64/bin
然后source /etc/profile 才会生效
显示已经成功写入环境变量
groupadd mysql
useradd -r -g mysql mysql -s /sbin/nologin
mkdir -p /data/mysql8_data
chown -R mysql:mysql /data/mysql8_data
chmod -R 750 /data/mysql8_data
在/usr/local/etc/下写一个配置文件my.cnf
vi /usr/local/etc/my.cnf
[mysql]
default-character-set=utf8mb4
[client]
port = 3306
socket = /tmp/mysql.sock
[mysqld]
port = 3306
server-id = 3306
user = mysql
socket = /tmp/mysql.sock
basedir = /usr/local/mysql8
datadir = /data/mysql8_data/mysql
log-bin = /data/mysql8_data/mysql/mysql-bin
innodb_data_home_dir =/data/mysql8_data/mysql
innodb_log_group_home_dir =/data/mysql8_data/mysql
log-error =/data/mysql8_data/mysql/mysql.log
pid-file =/data/mysql8_data/mysql/mysql.pid
character-set-server=utf8mb4
lower_case_table_names=1
autocommit =1
skip-external-locking
key_buffer_size = 256M
max_allowed_packet = 1M
table_open_cache = 1024
sort_buffer_size = 4M
net_buffer_length = 8K
read_buffer_size = 4M
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 64M
thread_cache_size = 128
#query_cache_size = 128M
tmp_table_size = 128M
explicit_defaults_for_timestamp = true
max_connections = 500
max_connect_errors = 100
open_files_limit = 65535
binlog_format=mixed
binlog_expire_logs_seconds =864000
default_storage_engine = InnoDB
innodb_data_file_path = ibdata1:10M:autoextend
innodb_buffer_pool_size = 1024M
innodb_log_file_size = 256M
innodb_log_buffer_size = 8M
innodb_flush_log_at_trx_commit = 1
innodb_lock_wait_timeout = 50
transaction-isolation=READ-COMMITTED
[mysqldump]
quick
max_allowed_packet = 16M
[myisamchk]
key_buffer_size = 256M
sort_buffer_size = 4M
read_buffer = 2M
write_buffer = 2M
[mysqlhotcopy]
interactive-timeout
mysqld --defaults-file=/usr/local/etc/my.cnf --basedir=/usr/local/mysql8 --datadir=/data/mysql8_data/mysql --user=mysql --initialize-insecure
ls /data/mysql8_data/mysql
nohup mysqld_safe --defaults-file=/usr/local/etc/my.cnf &
netstat -tunlp | grep 3306
mysql -uroot 登录
ALTER USER ‘root’@‘localhost’ IDENTIFIED WITH mysql_native_password BY ‘123456’;
flush privileges;
成功登录
create user ‘root’@‘%’ ;
ALTER USER ‘root’@‘%’ IDENTIFIED WITH mysql_native_password BY ‘123456’;
GRANT ALL PRIVILEGES ON . TO ‘root’@‘%’;
刷新权限
flush privileges;
连接MySQL
tar -xf jdk-8u221-linux-x64.tar.gz -C /opt
ln -s /opt/jdk1.8.0_221/ /opt/jdk8
echo 'export JAVA_HOME=/opt/jdk8
export PATH= P A T H : PATH: PATH:JAVA_HOME/bin
export CLASSPATH=.: J A V A H O M E / l i b / d t . j a r : JAVA_HOME/lib/dt.jar: JAVAHOME/lib/dt.jar:JAVA_HOME/lib/tools.jar’ >> /etc/profile
source /etc/profile
成功安装JDK
tar -xf apache-tomcat-8.0.27.tar.gz -C /opt/
ln -s /opt/apache-tomcat-8.0.27/ /opt/tomcat8
/opt/tomcat8/bin/version.sh
成功识别
/opt/tomcat8/bin/startup.sh
netstat -tunlp | grep 8080
在真机浏览器中输入ip:8080
将jpress.war 包部署到tomact下的webapps目录下
然后在浏览器中访问
ip:8080/jpress
随后进入安装向导界面
完成搭建
使用maven搭建jpress
先下载git工具
yum -y install git
git clone https://gitee.com/JPressProjects/jpress.git
此时会在上述连接的同名目录自动出现一个jpress的文件夹
解压maven包
tar -xvf apache-maven-3.3.9-bin.tar.gz -C /opt
修改maven源
vi /opt/apache-maven-3.3.9/conf/setting.xml
aliyunmaven * 阿里云公共仓库 https://maven.aliyun.com/repository/public然后输入
tomcat 关闭程序
/opt/tomcat8/bin/shutdown.sh
在开启maven
修改开启脚本
使用脚本并且传入参数start
./jpress.sh start
开启后可以使用命令
tail -f output.log
然后在浏览器中输入
localhost:10030/jpress/admin
即可登录后台管理系统
.9/conf/setting.xml
然后输入
tomcat 关闭程序
/opt/tomcat8/bin/shutdown.sh
在开启maven
修改开启脚本
使用脚本并且传入参数start
./jpress.sh start
开启后可以使用命令
tail -f output.log
然后在浏览器中输入
localhost:10030/jpress/admin
即可登录后台管理系统