preface

Due to work needs, the background server used in work needs to be deployed in the cloud, so I have the following work experience. Little brother not only, if there is any defect, please forgive me or leave a message.

The preparation of the instruments

  • Windows 7 computer
  • The putty tools
  • winscp
  • java
  • tomact
  • Navicat for mysql

Install and configure putty

  • Start the interface

  • 1. This section describes the important options of putty

    In this dialog box, enter the IP address, the port number is always 22, and the protocol is SSH. Name the dialog box root, and save the dialog box for the next login. Click open.Copy the code

  • 2. A dialog box is displayed after the first login

    I already installed it on my computer once, so I don’t have a screenshot here (think -, -).

    Tell you the host key fingerprint, click Yes to save it, the window will not pop up again, and then normal login. Click No not to save, next time I will remind you, and then you can log in normally. If we are just temporarily logging in to a host, of course, it is No. Cancel means hee hee, shut down!

  • 3. Enter your account and password. If the login is successful, the last login information will be returned. If the following interface is displayed, you have logged in successfully!

  • 4. Check the system

Example Query the system version information on the CLI

[root@VM_0_4_redhat ~]# cat /etc/redhat-release CentOS Release 7.3.1611 (Core)Copy the code

# # 5. Mysql installation

Most redhat installations found online are:

#yum install mysql
#yum install mysql-server
#yum install mysql-devel
Copy the code

However, I found in the test that the first two will return normal information, but the third line command, prompting failure. (Error code hint)

No package mysql-server available.
Copy the code

Later, I found out the reason: CentOS 7 removed the MySQL database software from the default program list and replaced it with Mariadb. Next I choose to continue installing mysql.

  • Change the mysql path to continue downloading

Download mysql Service from the official website, decompress it, and install it.

# wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
# rpm -ivh mysql-community-release-el7-5.noarch.rpm
# yum install mysql-community-server
Copy the code

After a period of waiting, mysql was successfully installed. Next, we restarted the mysql service

# service mysqld restart
Copy the code

The user name root does not have a password for the first installation.

# mysql -u root 
Copy the code

After press enter, the window will display the mysql version information and welcome statement, and the cursor will change to mysql>, we can view the local database information

show databases;
Copy the code

For insurance purposes, we need to set a password for the root user.

GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'password 'WITH GRANT OPTION; flush privileges;Copy the code

Of course, if we want to go back to the system directory we can also use exit to go back.

exit 
Copy the code

# # to install Java

– 1. Java download installation according to their above view their system information, download the corresponding JDK. Remember to check the accept option at the top. I downloaded a 64-bit tar.gz installation package here

After the download is complete, you need to use winscp to connect to the server, enter the IP address, account and password of the home page, and click to log in.

Enter the interface to find the appropriate path to create Java folder, I will use the root folder to be a level 1 directory, and then the COMPUTER downloaded JDK package CV to the cloud folder created.Copy the code

– 2. Use putty to decompress the JDK

The putty window is displayed. The operations are as follows:

CD /root/java tar -zvxf jdk-8u161-linux-x64.tar.gzCopy the code

– 3 Configure the Java environment

Let’s go back to the winscp interface, go back to the primary directory and find the ECT/profile file.

Add the following code to the end of the file. Use your own path and JDK file name.

Export JAVA_HOME=/root/ Java /jdk1.8.0_161 export CLASSPATH=/root/ Java /jdk1.8.0_161/lib export PATH=$JAVA_HOME/bin:$PATHCopy the code

Enter a command in putty to make our configuration take effect and check whether the Java version is correct

Source /etc/profile Java -version // Obtains the Java version informationCopy the code

Tomact installation and configuration

  • 1 at the beginning of this article, click tomACT download address, here we download tomACT 7 gz compressed version, after downloading, we will install the package to the server through winscp.

  • 2 CD switch to the directory above where you put the Tomact installation package and run:
The tar - ZVXF apache tomcat - 7.0.85. Tar. GzCopy the code
  • 3 Use winscp to change the name of tomact to the following for the convenience of the command line

  • 4 Modify the tomact configuration file. First, locate the service file in the conf folder of the tomact package and double-click it.

Find the “Connector node port” property. I’m using the default 8080 port here. You can change the port number as long as it corresponds to the port number when accessing the node, and add URIEncoding=” UTF-8 “at the end of the node.

At this point, we have completed the tomact download, decompress the configuration and so on, and we are ready to launch.

  • 5 Before startup, we’d better shut down and then start, the specific command is as follows:
CD /root/tomact/tomact/bin // Switch to my local tomact directory./shutdown.sh // Disable tomact./startup.sh // Start TomactCopy the code

Now that we have covered the simple installation and startup/shutdown of Tomact, let’s talk about the installation of nginx on centos.

If you want to install nginx on centos 6 or earlier, you need to install PCRE, zlib, and SSL. If you install the nginx library after centos 7, you can install the nginx library directly because the pcre zlib and SSL libraries are already included in the system.

  • 1 installing pcre
$CD/usr/local / $sudo wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.36.tar.gz $sudo tar ZXVF. - $CD pcl-8.36 $sudo./configure $sudo make $sudo make installCopy the code
  • 2 Install the Zlib library
$CD /usr/local/$sudo wget http://zlib.net/zlib-1.2.8.tar.gz $sudo tar -zxvf zlib-1.2.8.tar.gz $CD zlib-1.2.8 $sudo  ./configure $ sudo make $ sudo make installCopy the code
  • 3 to install SSL
$CD/usr/local / $sudo wget http://www.openssl.org/source/openssl-1.0.1j.tar.gz $sudo tar - ZXVF openssl - j.t. ar 1.0.1. Gz $ sudo ./config $ sudo make $ sudo make installCopy the code
  • 4 to install nginx
$CD/usr/local / $sudo wget http://nginx.org/download/nginx-1.8.0.tar.gz $sudo tar - ZXVF nginx - 1.8.0 comes with. Tar. Gz $CD Nginx-1.8.0 $sudo./configure --prefix=/usr/local/nginxCopy the code

If you are using a package and manually install the above dependencies compiled by the PCRE and Zlib libraries, you need to follow the following command after the –prefix:

--with-pcre= /usr/local/pre-8.36 --with-pcre= /usr/local/pre-8.36 --with-pcre= /usr/local/pre-8.36 --with-zlib=/usr/local/zlib-1.2.8 --with-zlib=/usr/local/zlib-1.2.8Copy the code
  • Part 5 important instructions

To test whether the configuration file is correct:

$ /usr/local/nginx/sbin/nginx -t
Copy the code

Activation:

$ /usr/local/nginx/sbin/nginx
Copy the code

Check whether the startup is successful:

Open a browser and access the IP of this machine. If the browser displays Welcome to nginx! Indicates that Nginx has been installed and is running successfully.

Some commands are as follows:

Resume:

$/ usr/local/nginx/sbin/nginx - s reloadCopy the code

Stop:

$/ usr/local/nginx/sbin/nginx - s stopCopy the code

Forced shutdown:

$ pkill nginx
Copy the code

Nginx: nginx: nginx: nginx: nginx: nginx: nginx: nginx: nginx: nginx: nginx: nginx: nginx: nginx: nginx: nginx: nginx: nginx: nginx: nginx: nginx:

  • 6 configure nginx

The common structure of Nginx configuration files from the outside to the inside is “HTTP”, “server”, “location”, etc. Server_name specifies the IP address or domain name. Multiple domain names can be separated by Spaces. Index specifies the default home page address to access. This could be a relative address or an absolute address. In the picture, I only configured the url mapping, but did not configure the nGINx load balancing. Those who want to learn more about NGINx can go to the nGINx explanation here to see in detail. Thanks for the predecessors’ blog explanation.

Reference article: Little Wood – Java Nginx reference blog