1.开发环境
CentOS 7.4 64位
JDK = 1.8 (jdk-8u251)
Nginx = 1.10.2.
Mysql = 5.6.0
Tomcat = 9.0.35
2.安装基本工具
# 2.1 安装vim
yum install vim
# 2.2 安装netstat工具
yum install net-tools # netstat -anp | grep 80 (查看端口是否开启)
3.安装JDK
# 3.1 解压jdk到指定目录
tar -zxvf jdk-8u251-linux-x64.tar.gz -C /usr/local/java/
# 3.2 配置jdk环境变量
sudo vim /etc/profile
:q 添加到末行
# jdk1.8
export JAVA_HOME=/usr/local/java/jdk1.8.0_251
export CLASSPATH=.:${JAVA_HOME}/jre/lib/rt.jar:${JAVA_HOME}/lib/dt.jar:${JAVA_HOME}/lib/tools.jar
export PATH=$PATH:${JAVA_HOME}/bin
:wq 保存
# 3.3 刷新配置
source /etc/profile
# 3.4 jdk 验证
java -version
4.安装Nginx
# 4.1 下载gcc
yum install gcc pcre-devel zlib zlib-devel openssl openssl-devel
# 4.2 解压缩
tar -zxvf nginx-1.10.3.tar.gz
# 4.3 进入解压目录执行
./configure
# 4.4 待上一步完成后编译执行
make && make install
# 4.5 测试启动(默认安装在/usr/local/nginx/)
/usr/local/nginx/sbin/nginx # 启动
/usr/local/nginx/sbin/nginx -sreload # 重启
/usr/local/nginx/sbin/nginx -sstop # 停止
或:
/usr/local/nginx/sbin/nginx -squit # 停止
# 4.6 设置开机启动
systemctl start nginx.service
# 4.7 创建启动服务文件
vi /lib/systemd/system/nginx.service
# 4.8 编辑内容
[Unit]
Description=nginx
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
# 4.9 保存退出后设置
systemctl enable nginx.service
5.安装mysql
# 5.1 先安装资源包
rpm -Uvh http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
# 5.2 查看当前可以用资源
yum repolist enabled | grep "mysql.*-community.*"
# 5.3 安装mysql
yum -y install mysql-community-server
# 5.4 安装完成测试
mysql -V
# 5.5 设置开机启动
#加入开机启动
systemctl enable mysqld
#启动mysql服务进程
systemctl start mysqld
# 5.6 登录并设置密码
mysql -uroot -p
set password for root@127.0.0.1=password('admin');
set password for root@localhost=password('admin');
6.安装Tomcat
# 6.1 解压
tar -zxvf apache-tomcat-9.0.35.tar.gz
# 6.2 配置环境变量
sudo vim /etc/profile
# 末尾增加
export CATALINA_HOME=/usr/local/tomcat/apache-tomcat-9.0.35
# 6.3 刷新配置
source /etc/profile
# 6.4 配置编码格式(找到配置8080默认端口的位置,在xml节点末尾增加 URIEncoding="UTF-8")
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" URIEncoding="UTF-8" />
7.安装redis
# 7.1 下载
wget http://download.redis.io/releases/redis-5.0.6.tar.gz
# 7.2 解压并安装
tar xzf redis-5.0.6.tar.gz
cd redis-5.0.6
make
# 7.3 启动服务
cd src
./redis-server
网友评论