1、关闭SELinux和防火墙
打开SELinux文件并修改SELINUX参数
vim /etc/sysconfig/selinux
SELINUX=disabled
执行如下命令 临时关闭(不用重启机器)
setenforce 0
关闭防火墙
systemctl stop firewalld.service
禁止防火墙开机启动
systemctl disable firewalld.service
2、安装Mysql
下载Mysql的repo源
wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
安装mysql-community-release-el7-5.noarch.rpm包
rpm -ivh mysql-community-release-el7-5.noarch.rpm
执行安装Mysql
yum install -y mysql-server
更改Mysql用户权限
chown -R root:root /var/lib/mysql
重启服务
systemctl restart mysql.service
查看Mysql是否开启
systemctl status mysql.service
登陆Mysql并修改密码
mysql -u root
mysql > use mysql;
mysql > update user set password=password(‘123456‘) where user=‘root‘;
mysql > GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'root' WITH GRANT OPTION;
mysql > flush privileges;
mysql > exit;
设置Mysql开机启动
systemctl enable mysqld.service
打开my.ini
vim /etc/my.ini
修改max_allowed_packet参数,无则添加(避免大数据写入或者更新失败)
max_allowed_packet = 20M
重启服务
systemctl restart mysql.service
3、安装Nginx
下载对应当前系统版本的Nginx包
wget http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
创建Nginx的yum仓库
rpm -ivh nginx-release-centos-7-0.el7.ngx.noarch.rpm
下载并安装Nginx
yum install -y nginx
开启Nginx
systemctl start nginx.service
查看Nginx是否运行成功
systemctl status nginx.service
设置Nginx开机启动
systemctl enable nginx.service
4、安装JAVA8
查看JAVA版本(是否已安装)
java -version
查看内置JDK
rpm -qa | grep java
移除内置JDK,按照依赖顺序删除(*号替换为需要删除的文件名)
rpm -e --nodeps *