Build LNMT architecture in Linux in detail

Source: Internet
Author: User

Environment Description:

IP Installed Services
192.168.209.12 Tomcat
192.168.209.13 Nginx MySQL
 Nginx Install ************************** 1.//Create System user nginx[[email protected] ~]# Useradd-r-m-s/sbin/nologin nginx//installation dependent environment [[email protected] ~]# yum-y install pcre-devel OpenSSL openssl-devel GD -devel[[email protected] ~]# yum-y groups Mark install ' Development Tools '//create log storage directory [[email protected] ~]# Mkdir-p/var/log/nginx[[email protected] ~]# chown-r nginx.nginx/var/log/nginx//Download nginx[[email protected ] ~]# cd/usr/src/[[email protected] src]# wgethttp://nginx.org/download/nginx-1.14.0.tar.gz//compile and install [email  protected] src]# tar XF nginx-1.14.0.tar.gz[[email protected] src]# CD nginx-1.14.0[[email protected] nginx-1.14.0]#./configure--prefix=/usr/local/nginx--user=nginx--group=nginx--with-debug--with-http_ssl_module- -with-http_realip_module--with-http_gunzip_module--with-http_gzip_static_module--with-http_stub_status_module- -http-log-path=/var/log/nginx/access.log--error-log-path=/var/log/ngInx/error.log[[email protected] nginx-1.14.0]# make-j $ (grep ' processor '/proc/cpuinfo | wc-l) && Make Inst All 2.nginx post-installation configuration//configuration environment variables [[[email protected] ~]# echo ' export path=/usr/local/nginx/sbin: $PATH ' >/etc/ Profile.d/nginx.sh[[email protected] ~]# source/etc/profile.d/nginx.sh [[email protected] ~]# nginx[[      Email protected] ~]# ss-antlstate recv-q send-q Local address:port Peer Address:portlisten                               0 *:111 *:* LISTEN 0 128 *:80      *:* LISTEN 0 *:22 *:* LISTEN 0                             *:40154 *:* LISTEN 0 64 *:2049                 *:* LISTEN 0::: 111:::* LISTEN 0 128                              ::: 22:::* LISTEN 0::: 2049:::* LISTEN 0 64: :: 34409:::*
MySQL Install ****************************//install dependency package [[email protected] ~]# yum-y Install Ncurses-devel openssl-devel OpenSSL cmake mariadb-devel//create users and Groups [[email protected] ~]# Cd/usr/src/[[email  protected] src]# groupadd-r-G 306 mysql[[email protected] src]# useradd-m-s/sbin/nologin-g 306-u 306 Mys ql//download MySQL package in binary format [[email protected] src]# wget https://downloads.mysql.com/archives/get/file/ mysql-5.7.22-linux-glibc2.12-x86_64.tar.gz//decompression software to/usr/local[[email protected] src]# tar XF Mysql-5.7.22-linux-glibc2.12-x86_64.tar.gz-c/usr/local/[[email protected] src]# cd/usr/local///Create a soft connection [email  protected] local]# ln-sv mysql-5.7.22-linux-glibc2.12-x86_64/mysql//Modify the genus group/usr/local/mysql of the directory [[email  Protected] local]# chown-r mysql.mysql/usr/local/mysql[[email protected] local]# ll/usr/local/mysql//Add environment variable [[ Email protected] ~]# ls/usr/local/mysql[[email protected] ~]# echo ' Export path=/usr/local/mysqL/bin: $PATH ' >/etc/profile.d/mysql.sh[[email protected] ~]# source/etc/profile.d/mysql.sh[[email  Protected] ~]# echo $PATH//Set up data storage directory [[email protected] ~]# mkdir/opt/data[[email protected] ~]# chown-r MySQL . mysql/opt/data/[[email protected] ~]# ll/opt/total dosage 0drwxr-xr-x. 2 MySQL MySQL 6 August 13:20 data//Initialize database Note This command will generate a temporary password to remember jd?ajfrky4pq[[email protected] ~]#/usr/local/mysql/bin/ Mysqld--initialize--user=mysql--datadir=/opt/data///configuration mysql//Soft Connection [[email protected] ~]# ln-sv/usr/local/ mysql/include//usr/local/include/mysql[[email protected] ~]# echo '/usr/local/mysql/lib ' >/etc/ Ld.so.conf.d/mysql.conf[[email protected] ~]# ldconfig-v//Generate configuration file [[email protected] ~]# cat >/etc/ MY.CNF << eof> [mysqld]> basedir =/usr/local/mysql> DataDir =/opt/data> socket =/tmp/mysql.sock> p ORT = 3306> Pid-file =/opt/data/mysql.pid> user = mysql> skip-name-resolve> eof//Config service startup script [[email  ProtecteD] ~]# cp-a/usr/local/mysql/support-files/mysql.server/etc/init.d/mysqld[[email protected] ~]# sed-ri ' s#^ ( basedir=). *#\1/usr/local/mysql#g '/etc/init.d/mysqld[[email protected] ~]# sed-ri ' s#^ (datadir=). *#\1/opt/ Data#g '/etc/init.d/mysqld//start mysql[[email protected] ~]# service mysqld start[[email protected] ~]# ps-ef | grep mysql[[email protected] ~]# ss-antllisten 0 80::: 3306: ::*//Change password login using temporary password [[[email protected] ~]# mysql-uroot-p Description: JD?AJFRKY4PQ This is the temporary password for the above steps mysql> set Password = Pass Word (' lanzhiyong ');
Tomcat Project Deployment ************************//java Environment installation, installing the JDK environment [[email protected] ~]# Yum-y install JAVA-1.8.0-OPENJDK java-1.8.0-openjdk-devel[[email protected] ~]# java-version//Download tomcat[[email& Nbsp;protected] ~]# cd/usr/src/[[email protected] src]# wget https://archive.apache.org/dist/tomcat/tomcat-9/ v9.0.8/bin/apache-tomcat-9.0.8.tar.gz//decompression deployment [[email protected] src]# tar XF apache-tomcat-9.0.8.tar.gz-c/usr/ Local/[[email protected] local]# tar XF apache-tomcat-9.0.8.tar.gz[[email protected] local]# MV apache-tomcat-9.0.8 apache2[[email protected] local]# mv apache2/usr/local/[[email protected] src]# cd/usr /local/[[email protected] local]# ln-s apache2/tomcat2[[email protected] local]# ln-s apache-tomcat-9.0.8/ Tomcat[[email protected] local]# ll//Write a Java page for TOMCAT,TOMCAT2 [[email protected] ~]# vim index.jsp[[                 Email protected] ~]# Cat index.jsp
***************************nginx配置********************************[[email protected] conf]# vim /usr/local/nginx/conf/nginx.conf//添加以下模块upstream web {             server 192.168.209.12:8080;             server 192.168.209.12:8081;  } server{        location / {               proxy_pass http://web;     }}

[[email protected] conf]# nginx -s reload 最后验证输入:192.168.209.13/test/ 刷新看效果


Build LNMT architecture in Linux in detail

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.