1.CentOS7虚拟机安装,固定IP,Xshell和Xftp的使用默认读者已经了解
2.CentOS7安装vim
yum -y install vim*
3.CentOS7安装jdk
(1)下载rpm版jdk
(2)Xftp新增/usr/local/jdk文件夹,并将jdk的rpm文件放入
(3)进入目录。安装jdk
cd /usr/local/jdk
rpm -ivh jdk-8u271-linux-x64.rpm
java -version查看安装情况
4.CentOS7安装redis
(1)下载redis的tar.gz包
(2) Xftp新增/usr/local/redis,并将redis的tar.gz文件放入
(3)安装gcc,进入目录,解压tar包,进入目录,执行编译,指定目录安装
yum install -y gcc
cd /usr/local/redis
tar -xvzf redis-5.0.10.tar.gz
cd /usr/local/redis/redis-5.0.10
make
make install PREFIX=/usr/local/redis
(4)后台启动
// 复制配置文件
cp /usr/local/redis/redis-5.0.10/redis.conf /usr/local/redis/bin/
// 修改 redis.conf 文件,把 daemonize no 改为 daemonize yes
// 去掉bind 的127.0.0.1绑定
// protected-mode改为no
cd /usr/local/redis/bin/
vim redis.conf
(5)设置开机启动
vim /etc/systemd/system/redis.service
复制粘贴以下内容
[Unit]
Description=redis-server
After=network.target
[Service]
Type=forking
ExecStart=/usr/local/redis/bin/redis-server /usr/local/redis/bin/redis.conf
PrivateTmp=true
[Install]
WantedBy=multi-user.target
开机启动
// 设置开机启动
systemctl daemon-reload
systemctl start redis.service
systemctl enable redis.service
//创建 redis 命令软链接
ln -s /usr/local/redis/bin/redis-cli /usr/bin/redis
5.CentOS7安装nginx
(1)下载nginx的tar.gz包
(2) Xftp新增/usr/local/nginx,并将nginx的tar.gz文件放入
(3) pcre、pcre-devel、openssl安装
yum install -y pcre pcre-devel
yum install -y openssl openssl-devel
(4)进入目录,解压tar包,进入目录,执行编译
cd /usr/local/nginx
tar -xvzf nginx-1.18.0.tar.gz
cd /usr/local/nginx/nginx-1.18.0
./configure
make
make install PREFIX=/usr/local/nginx
(5)开机自启动
vim /etc/systemd/system/nginx.service
复制粘贴以下内容
[Unit]
Description=nginx server daemon
Documentation=man:nginx(8)
After=network.target
[Service]
Type=forking
ExecStart=/usr/local/nginx/sbin/nginx
ExecReload=/usr/local/nginx/sbin/nginx -s reload
ExecStop=/usr/local/nginx/sbin/nginx -s quit
PrivateTmp=true
[Install]
WantedBy=multi-user.target
操作
systemctl daemon-reload
systemctl start nginx.service
systemctl enable nginx.service
systemctl status nginx.service
6.CentOS7放开端口
//防火墙开启端口
firewall-cmd --zone=public --add-port=80/tcp --permanent
firewall-cmd --zone=public --add-port=6379/tcp --permanent
//重启防火墙
firewall-cmd --reload
//防火墙取消某一开放端口
firewall-cmd --zone=public --remove-port=9200/tcp --permanent
7.nacos安装
(1) Xftp新增/usr/local/nacos,并将nacos放入,进入bin sh启动
cd /usr/local/nacos/bin
sh startup.sh -m standalone