CentOS7软件环境

原创
2018/03/01 00:36
阅读数 225

一、软件环境

1.1 centos7

[root@centos7 ~]# cat /etc/redhat-release 
CentOS Linux release 7.4.1708 (Core) 
[root@centos7 ~]# uname -r
3.10.0-693.17.1.el7.x86_64

# 安装编译需要的工具
yum groupinstall "Compatibility libraries" "Base" "Development tools" -y
# yum groupinstall "debugging Tools" "Dial-up Networking Support" -y
yum grouplist

1.2 jdk

jdk-8u152-linux-x64.tar.gz

mkdir -p /opt/java
tar -xzv -f jdk-8u152-linux-x64.tar.gz -C /opt/java/
ln -s /opt/java/jdk1.8.0_152 /usr/local/jdk

配置jdk环境变量

# 针对所有用户
vi /etc/profile
# 只针对当前用户
vi ~/.bashrc

vi /etc/profile.d/jdk.sh
# 添加如下内容
export JAVA_HOME=/usr/local/jdk
export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$JAVA_HOME/bin:$PATH

source /etc/profile
java -version

1.3 nginx

http://nginx.org/en/docs/configure.html

nginx-1.13.9.tar.gz

# 创建目录
mkdir -p /opt/nginx/nginx-1.13.9

# 创建用户
id nginx
useradd nginx -s /sbin/nologin -M

# 安装pcre openssl
rpm -qa pcre pcre-devel
rpm -qa openssl openssl-devel
yum install pcre pcre-devel -y
yum install openssl openssl-devel -y

# 解压、编译安装
tar -xzvf nginx-1.13.9.tar.gz
cd nginx-1.13.9
./configure --user=nginx --group=nginx --prefix=/opt/nginx/nginx-1.13.9 --with-http_stub_status_module --with-http_ssl_module
make
make install

# chown -R nginx:nginx /opt/nginx/

ln -s /opt/nginx/nginx-1.13.9 /usr/local/nginx

配置nginx环境变量

vi /etc/profile.d/nginx.sh
# 添加如下内容
export PATH=/usr/local/nginx/sbin:$PATH

source /etc/profile

操作nginx

# 检查配置文件
nginx -t
# 启动
nginx
# 平滑启动
nginx -s reload
# 检查
netstat -tunlp | grep nginx

1.4 tomcat

apache-tomcat-8.5.28.tar.gz

# 创建目录
mkdir -p /opt/tomcat

# 解压
tar -xzvf apache-tomcat-8.5.28.tar.gz -C /opt/tomcat

配置tomcat环境变量(多实例情况下要配置)

vi /etc/profile.d/tomcat.sh
# 添加如下内容
#export TOMCAT_HOME=/usr/local/tomcat
#export CATALINA_HOME=/usr/local/tomcat
#export CATALINA_BASE=/usr/local/tomcat
#export CATALINA_TMPDIR=/usr/local/tomcat/temp

普通用户启动tomcat

# CATALINA_HOME=/usr/local/tomcat

cd $CATALINA_HOME/bin

# 解压commons-daemon-native.tar.gz
tar -xzvf commons-daemon-native.tar.gz
cd commons-daemon-native-src/unix

# 编译生成jsvc
./configure
make

# 将jsvc复制到$CATALINA_HOME/bin目录
cp jsvc $CATALINA_HOME/bin

# 添加一个tomcat用户
id tomcat
useradd tomcat -s /sbin/nologin -M

# 查看帮助
./daemon.sh -h

# 启动Tomcat
./daemon.sh start

# 查看进程
ps -aux | grep tomcat

设置权限

# 设置权限
cd /opt/tomcat
# 该目录归属为tomcat小组
sudo chgrp -R tomcat /opt/tomcat
cd apache-tomcat-8.5.28
# tomcat组对conf目录及其内容有读权限
sudo chmod -R g+r conf
# 对conf目录有执行权限
sudo chmod g+x conf
# 设置tomcat用户是webapps/, work/, temp/, logs/这几个目录的主人
sudo chown -R tomcat webapps/ work/ temp/ logs/

展开阅读全文
打赏
0
7 收藏
分享
加载中
更多评论
打赏
0 评论
7 收藏
0
分享
返回顶部
顶部