Build an open source project 9 – install application server Tomcat / ngix / docker


1、 Application server Tomcat installation and deployment

  • takeapache-tomat-8.5.55.tar.gzPut in\rootUnder the table of contents
  • stay/usr/localCreate undertomcatFolder, and enter, unzip the installation package to this directory
[[email protected] ~]# cd /usr/local
[[email protected] local]# mkdir tomcat
[[email protected] local]# cd tomcat
[[email protected] tomcat]# tar -zxvf /root/apache-tomcat-8.5.55.tar.gz -C ./
  • Start Tomcat
[[email protected] tomcat]# cd apache-tomcat-8.5.55/
[[email protected] apache-tomcat-8.5.55]# cd bin
[[email protected] bin]# ./
[[email protected] bin]# firewall-cmd --zone=public --add-port=8080/tcp --permanent
[[email protected] bin]# firewall-cmd --reload


  • Windows browser can access IP: 8080
  • Configure shortcut operation and startup
  • Create a folder and give it executive permission to edittomcatfile
[[email protected] bin]# cd /etc/rc.d/init.d/
[[email protected] init.d]# touch tomcat
[[email protected] init.d]# chmod +x tomcat
#chkconfig:- 20 90
case $1 in
        start) su root $TOMCAT_HOME/bin/;;
        stop) su root $TOMCAT_HOME/bin/;;
        *) echo "require start|stop";;

  • For the subsequent opening and closing of tomcat, you only need to execute the following command
[[email protected] init.d]# service tomcat start
[[email protected] init.d]# service tomcat stop
  • Finally, add the boot item
[[email protected] tomcat]# chkconfig --add tomcat
[[email protected] tomcat]# chkconfig tomcat on
  • If the servce command is not easy to use, see: \

The service command is used to manage system services, such as start, stop, restart, status, etc.
The service command itself is a shell script that looks for the specified service script in the /etc/init.d/ directory and then invokes the service script to complete the task.
When service runs the specified service (called System V initial script), it removes most of the environment variables, only retains the two environment variables Lang and term, and sets the current path to /, that is, it runs the service script in a predictable and clean environment. This script is stored in the / etc / init. D directory, and it should at least support the start and stop commands.
Quoted from:

Chkconfig command is used to update (start or stop) and query the run level information of system services. Keep in mind that chkconfig does not automatically disable or activate a service immediately, it simply changes the symbolic connection.
Usage syntax:
Chkconfig [– add] [– del] [– list] [system service] or chkconfig [– level] [system service] [on / off / reset]
Chkconfig displays usage when running without parameters. If the service name is added, check whether the service is started at the current run level. If on, off or reset is specified after the service name, chkconfi will change the startup information of the specified service. On and off means that the service is started and stopped respectively, and reset means to reset the startup information of the service, no matter what is specified in the problematic initialization script. On and off switches. By default, the system is only valid for runlevels 3, 4 and 5, but reset is valid for all runlevels.
Parameter usage:
– add adds the specified system service to enable chkconfig command to manage it, and adds relevant data in the system startup description file.
– del delete the specified system service, which is no longer managed by chkconfig command, and delete the related data in the system startup description file
– level specifies the execution level at which the read system service should be turned on or off
Level 0 indicates: shutdown
Level 1: single user mode
Level 2: multi user command line mode without network connection
Level 3: multi user command line mode with network connection
Level 4 indicates: not available
Level 5: multi user mode with graphical interface
Level 6 means restart
Quoted from:

2、 Install web server nginx

1. Install the packagenginx-1.17.10.tar.gzPut in\rootbelow

  • stay/usr/local/Create undernginxFolder and enter unzip
[[email protected] ~]# cd /usr/local
[[email protected] local]# mkdir nginx
[[email protected] local]# cd nginx/
[[email protected] nginx]# tar zxvf /root/nginx-1.17.10.tar.gz  -C ./
[[email protected] nginx]# cd nginx-1.17.10/
[[email protected] nginx-1.17.10]# yum -y install pcre-devel^C
  • Pre install additional dependencies
[[email protected] nginx-1.17.10]# yum -y install pcre-devel
[[email protected] nginx-1.17.10]# yum -y install openssl openssl-devel
  • Compile and install nginx
[[email protected] nginx-1.17.10]# ./configure
[[email protected] nginx-1.17.10]# make && make install
  • After installation, the nginx executable is located at
  • Start and close ngix, and modify the configuration to reload ngix
[[email protected] nginx-1.17.10]# /usr/local/nginx/sbin/nginx 
[[email protected] nginx-1.17.10]# /usr/local/nginx/sbin/nginx -s stop
[[email protected] nginx-1.17.10]# /usr/local/nginx/sbin/nginx -s reload
  • Note that the configuration file is located in/usr/local/nginx/conf/nginx.conf
  • After opening the port firewall, log inhttp: will do

3、 Install docker

  • Install docker directly, and start and view the installation results
[[email protected] nginx-1.17.10]# yum install -y docker
[[email protected] nginx-1.17.10]# systemctl start docker.service
[[email protected] nginx-1.17.10]# docker version


  • Set startup and configure download acceleration under docker image
[[email protected] nginx-1.17.10]# systemctl enable docker.service
[[email protected] nginx-1.17.10]# docker pull mysql


  • We can see from the figure that the download speed is very slow, so we manually configure the image acceleration source to improve the access speeddockerImage speed
[[email protected] nginx-1.17.10]# vim /etc/docker/daemon.json
  • Netease’s acceleration source is used here. You can also use alicloud, daocloud and other resources. After configuration, reload the configuration file and restart docker
[[email protected] nginx-1.17.10]# systemctl daemon-reload
[[email protected] nginx-1.17.10]# systemctl restart docker.service
  • This is the configuration

Systemctl provides a set of subcommands to manage a single unit
systemctl [command] [unit]
Command mainly includes:
Start: start the following unit immediately.
Stop: close the following unit immediately.
Restart: immediately close and start the following unit, which means stop and start again.
Reload: without closing the unit, reload the configuration file to make the settings take effect.
Enable: set that the next unit will be started.
Disable: set that the next unit will not be started.
Status: the current status of the following unit will list the information such as whether it is being executed or not, whether it will be started when it is started, etc.
Is active: is it running.
Is enable: whether the unit is enabled by default at boot time.
Kill: don’t be scared by the name kill. It’s actually sending a signal to the process running unit.
Show: lists the configuration of the unit.
Mask: you can’t start the unit after you log off.
Unmask: cancel the logout of unit.
Quoted from:

4、 Source code:

  • Build an open source project 9 – install application server Tomcat / ngix\
  • Build an open source project 9 – install application server Tomcat / ngix\
  • CSDN:
  • Blog Park:
  • Welcome to WeChat official account: Fourier transform, personal account, for technical exchange only.

Recommended Today

Rust and python: why rust can replace Python

In this guide, we compare the rust and python programming languages. We will discuss the applicable use cases in each case, review the advantages and disadvantages of using rust and python, and explain why rust might replace python. I will introduce the following: What is rust? What is Python? When to use rust When to […]