2.linux静态ip
vim /etc/sysconfig/network-scripts/ifcfg-eth0
service network restart
3.Tomcat安装
步骤:
1)上传Tomcat到linux上
2)解压Tomcat到/usr/local下
3)开放Linux的对外访问的端口8080
/sbin/iptables -I INPUT -p tcp --dport 8080 -j ACCEPT
/etc/rc.d/init.d/iptables save
4)启动关闭Tomcat
进入tomcat的bin下启动:./startup.sh
进入tomcat的bin下关闭:./shutdown.sh
4.关闭防火墙
systemctl stop firewalld.service #停止firewall
systemctl disable firewalld.service #禁止firewall开机启动
关闭:service iptables stop
永久关闭:chkconfig iptables off
5.安装jdk
查看之前是否安装
java rpm -qa | grep jdk
输入
rpm -e --nodeps 要卸载的软件
卸载之前安装的jdk
下载运行jdk插件
yum install glibc.i686
将jdk拷贝进root目录,并且进入root目录
将jdk解压到 /opt/SoftWare/java 下
tar -xvf jdk-8u141-linux-x64.tar.gz -C /opt/SoftWare/java/
tar -xvf jdk-8u141-linux-x64.tar.gz -C /opt/SoftWare/tomcat/
配置jdk环境变量,打开/etc/profile配置文件,将下面配
置拷贝进去
#set java environment
export JAVA_HOME=/opt/SoftWare/Java/jdk1.8.0_141
export JRE_HOME=/opt/SoftWare/Java/jdk1.8.0_141/jre
export CLASSPATH=.:$JRE_HOME/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin
重新加载/etc/profile配置文件
source /etc/profile
java -version 或者 javac 或者 java 是否都识别,
识别就证明安装成功。
虚拟机安装nginx:
nginx是C语言开发,建议在linux上运行,本教程使用Centos6.5作为安装环境。
- gcc
安装nginx需要先将官网下载的源码进行编译,编译依赖gcc环境,如果没有gcc环境,需要安装gcc:
yum install gcc-c++
- PCRE
PCRE(Perl Compatible Regular Expressions)是一个Perl库,包括 perl 兼容的正则表达式库。nginx的http模块使用pcre来解析正则表达式,所以需要在linux上安装pcre库。
yum install -y pcre pcre-devel
注:pcre-devel是使用pcre开发的一个二次开发库。nginx也需要此库。
- zlib
zlib库提供了很多种压缩和解压缩的方式,nginx使用zlib对http包的内容进行gzip,所以需要在linux上安装zlib库。
yum install -y zlib zlib-devel
- openssl
OpenSSL 是一个强大的安全套接字层密码库,囊括主要的密码算法、常用的密钥和证书封装管理功能及SSL协议,并提供丰富的应用程序供测试或其它目的使用。
nginx不仅支持http协议,还支持https(即在ssl协议上传输http),所以需要在linux安装openssl库。
yum install -y openssl openssl-devel
2 编译安装
将nginx-1.8.0.tar.gz拷贝至linux服务器。
解压:
tar -zxvf nginx-1.8.0.tar.gz
cd nginx-1.8.0
1、 configure
./configure --help查询详细参数
1在线安装4个环境
2上传nginx安装包到 /opt/software/nginx
3解压 tar -xvf 安装包名
4在 /usr/local 下创建文件夹nginx
5在 /var 下创建 /temp/nginx 文件夹
6在解压目录执行配置
./configure \
--prefix=/usr/local/nginx \
--pid-path=/var/run/nginx/nginx.pid \
--lock-path=/var/lock/nginx.lock \
--error-log-path=/var/log/nginx/error.log \
--http-log-path=/var/log/nginx/access.log \
--with-http_gzip_static_module \
--http-client-body-temp-path=/var/temp/nginx/client \
--http-proxy-temp-path=/var/temp/nginx/proxy \
--http-fastcgi-temp-path=/var/temp/nginx/fastcgi \
--http-uwsgi-temp-path=/var/temp/nginx/uwsgi \
--http-scgi-temp-path=/var/temp/nginx/scgi
7
make
8
make install
9关闭防火墙
cd / nginx-1.8.0
+ [root@localhost nginx-1.8.0]# ./configure \
> --prefix=/usr/local/nginx \
> --pid-path=/var/run/nginx/nginx.pid \
> --lock-path=/var/lock/nginx.lock \
> --error-log-path=/var/log/nginx/error.log \
> --http-log-path=/var/log/nginx/access.log \
> --with-http_gzip_static_module \
> --http-client-body-temp-path=/var/temp/nginx/client \
> --http-proxy-temp-path=/var/temp/nginx/proxy \
> --http-fastcgi-temp-path=/var/temp/nginx/fastcgi \
> --http-uwsgi-temp-path=/var/temp/nginx/uwsgi \
> --http-scgi-temp-path=/var/temp/nginx/scgi
checking for OS
checking for gcc -pipe switch ... found
checking for gcc builtin atomic operations ... found
checking for C99 variadic macros ... found
checking for gcc variadic macros ... found
checking for unistd.h ... found
checking for inttypes.h ... found
checking for limits.h ... found
C"/var/temp/nginx/fastcgi"
nginx http uwsgi temporary files: "/var/temp/nginx/uwsgi"
nginx http scgi temporary files: "/var/temp/nginx/scgi"
+ [root@localhost nginx-1.8.0]# make
make -f objs/Makefile
make[1]: 进入目录“/opt/SoftWare/nginx/nginx-1.8.0”
cc -c -pipe -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs \
make[1]: 离开目录“/opt/SoftWare/nginx/nginx-1.8.0”
+ [root@localhost nginx-1.8.0]# make install
make -f objs/Makefile install
make[1]: 进入目录“/opt/SoftWare/nginx/nginx-1.8.0”
test -d '/usr/local/nginx' || mkdir -p '/usr/local/nginx'
test -d '/usr/local/nginx/sbin' || mkdir -p
test -d '/var/log/nginx' || mkdir -p '/var/log/nginx'
make[1]: 离开目录“/opt/SoftWare/nginx/nginx-1.8.0”
+ [root@localhost nginx-1.8.0]# cd /usr/local/nginx/sbin/
[root@localhost sbin]# ./nginx
[root@localhost sbin]# cd /usr/local/nginx/
[root@localhost nginx]# ls
conf html sbin
[root@localhost nginx]# cd conf/
[root@localhost conf]# ls
fastcgi.conf koi-utf nginx.conf uwsgi_params
fastcgi.conf.default koi-win nginx.conf.default uwsgi_params.default
fastcgi_params mime.types scgi_params win-utf
fastcgi_params.default mime.types.default scgi_params.default
[root@localhost conf]# vi nginx.conf
修改root 路径 html 改为自建图片存储目录
[root@localhost conf]# cd ../
[root@localhost nginx]# cd sbin/
[root@localhost sbin]# ./nginx -s reload