Tomcat 服务器是一个免费的开放源代码的 Web 应用服务器,属于轻量级应用服务器,在中小型 系统和并发访问用户不是很多的场合下被普遍使用,是开发和调试 JSP 程序的首选。Tomcat 是 Apache 服务器的扩展,但运行时它是独立运行的,所以当你运行 tomcat 时,它实际上作为一个与 Apache 独 立的进程单独运行的。
# yum install gcc -y
# tar -zxvf jdk-8u202-linux-x64.tar.gz # mv jdk1.8.0_202/ /usr/local/jdk # vim /etc/profile export JAVA_HOME=/usr/local/jdk export JAVA_BIN=/usr/local/jdk/bin export PATH=$PATH:$JAVA_HOME/bin export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar # source /etc/profile
[root@centos jdk]# java -version java version "1.7.0_99" OpenJDK Runtime Environment (rhel-2.6.5.1.el6-x86_64 u99-b00) OpenJDK 64-Bit Server VM (build 24.95-b01, mixed mode)
# tar -zxvf apache-tomcat-8.5.49.tar.gz # mv apache-tomcat-8.5.49 /usr/local/tomcat/
# vim /etc/profile export TOMCAT_HOME=/usr/local/tomcat export PATH=$PATH:$TOMCAT_HOME/bin # source /etc/profile
# chmod +x /usr/local/tomcat/bin/* # /usr/local/tomcat/bin/catalina.sh start Using CATALINA_BASE: /usr/local/tomcat Using CATALINA_HOME: /usr/local/tomcat Using CATALINA_TMPDIR: /usr/local/tomcat/temp Using JRE_HOME: /usr/local/jdk Using CLASSPATH: /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar Tomcat started.
# yum -y install ncurses-devel cmake
# tar -zxvf mysql-5.5.48.tar.gz # useradd -r -s /sbin/nologin mysql # cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_UNIX_ADDR=/tmp/mysql.sock -DEXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_MEMORY_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DENABLED_LOCAL_INFILE=1 -DMYSQL_USER=mysql -DMYSQL_TCP_PORT=3306 # make && make install
# cp -a support-files/my-medium.cnf /etc/my.cnf # ln -s /usr/local/mysql/bin/* /usr/local/bin/ # ln -s /usr/local/mysql/sbin/* /usr/local/sbin/
# cd /usr/local/mysql # ./scripts/mysql_install_db --user=mysql
# cp -a /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld # chkconfig --add mysqld #添加至自启动管理列表 # chkconfig mysqld on #设置开机自启 # service mysqld start|stop|restart
# mysqladmin -uroot password 123456
yum -y install pcre-devel
# tar -zxvf nginx-1.12.2.tar.gz # useradd -r -s /sbin/nologin nginx # ./configure --user=nginx --group=nginx # make && make install
upstream tomcat { server 100.100.100.105:8080; } server { listen 80; server_name localhost; #charset koi8-r; #access_log logs/host.access.log main; location / { proxy_pass http://tomcat; proxy_set_header Host $host; }
# /usr/local/nginx/sbin/nginx -t # /usr/local/nginx/sbin/nginx -s reload
# vim /usr/local/tomcat/conf/server.xml <Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true"> <Context path="" docBase="123.war" debug="0" privileged="true"/>
# cp -a 123.war /usr/local/tomcat/webapps/ # rm -rf /usr/local/tomcat/webapps/ROOT/
# /usr/local/tomcat/bin/catalina.sh stop # /usr/local/tomcat/bin/catalina.sh start