1、部署环境
测试版本基于Ubuntu 20.04.6 LTS安装
2、安装mysql
(如果系统已经自带安装了可以忽略)
(1)首先上传文件到服务器目录下,如下:
(2)安装所需依赖
cd /home/ubuntu/tool
sudo dpkg -i libmecab2_0.996-1.2ubuntu1_amd64.deb
sudo dpkg -i libaio1_0.3.110-2_amd64.deb
sudo dpkg -i libtinfo5_6.2-0ubuntu2_amd64.deb
执行过程中如果出现如下报错就执行下面的两步
sudo rm /var/lib/dpkg/lock-frontend
sudo rm /var/lib/dpkg/lock
(3)解压mysql安装包
sudo tar -xvf mysql-server_5.7.23-1ubuntu16.04_amd64.deb-bundle.tar
解压后目录如下:
(4)安装MySQL
sudo dpkg -i mysql-common_5.7.23-1ubuntu16.04_amd64.deb
sudo dpkg-preconfigure mysql-community-server_5.7.23-1ubuntu16.04_amd64.deb //此步需要输入数据的root密码
sudo dpkg -i libmysqlclient20_5.7.23-1ubuntu16.04_amd64.deb
sudo dpkg -i libmysqlclient-dev_5.7.23-1ubuntu16.04_amd64.deb
sudo dpkg -i libmysqld-dev_5.7.23-1ubuntu16.04_amd64.deb
sudo dpkg -i mysql-community-client_5.7.23-1ubuntu16.04_amd64.deb
sudo dpkg -i mysql-client_5.7.23-1ubuntu16.04_amd64.deb
sudo dpkg -i mysql-common_5.7.23-1ubuntu16.04_amd64.deb
sudo dpkg -i mysql-community-server_5.7.23-1ubuntu16.04_amd64.deb
sudo dpkg -i mysql-server_5.7.23-1ubuntu16.04_amd64.deb
(5)验证MySQL的安装是否成功
mysql -u root -p //输入密码
(6)查看mysql状态:
sudo systemctl status mysql.service
3、安装java
(如果系统已经自带安装了可以忽略)
(1)解压
cd /home/ubuntu/tool
tar -zxvf jdk-8u211-linux-x64.tar.gz
(2)配置环境变量
sudo ln -s /home/ubuntu/tool/jdk1.8.0_211/bin/java /usr/bin/java
(3)检验JDK的安装
# 查看版本
java -version
# 查看编译器
javac
# 若以上命令都执行成功,则表示安装成功,否则请检查路径是否正确。
4、安装nginx
(如果系统已经自带安装了可以忽略)
(1)把文件上传到/opt下
(2)解压
unzip nginx.zip
cd /opt/nginx/yl
sudo dpkg -i *.deb //执行两遍
4.1 安装pcre
cd /opt/nginx
sudo tar zxvf pcre-8.34.tar.gz
cd pcre-8.34
sudo ./configure
sudo make
sudo make install
4.2 安装openssl
cd /opt/nginx
sudo tar -zxvf openssl-1.1.1b.tar.gz
cd openssl-1.1.1b
sudo ./config
sudo make
sudo make install
4.3 安装zlib
cd /opt/nginx
sudo tar -xvf zlib-1.2.11.tar.gz //解压zlib
cd zlib-1.2.11 //进入zlib
sudo ./configure
sudo make
sudo make install
4.4 安装yasm
cd /opt/nginx
sudo tar zxvf yasm-1.3.0.tar.gz
cd yasm-1.3.0
sudo ./configure
sudo make
sudo make install
4.5 nginx 安装
cd /opt/nginx
sudo tar -zxvf nginx-1.18.0.tar.gz
cd nginx-1.18.0
配置如下:
sudo ./configure --with-http_ssl_module
sudo make
sudo make install
4.6 启动nginx
nginx的目录在/usr/local/nginx下
sudo /usr/local/nginx/sbin/nginx
/usr/local/nginx/sbin/nginx -s reload
sudo /usr/local/nginx/sbin/nginx -t 检查配置文件是否正确