Small knowledge, big challenge! This article is participating in the creation activity of “Essential Tips for Programmers”.

background

Company project: set up performance test environment, simple structure, nginx load balancing, weight polling, redis cache, MongoDB hot library, Mysql, Tomcat deployment mode, Jenkins integration package deployment environment, Nodejs, Maven environment, a lot of application software. But instead of using dubbo or Spring Boot microservices architecture or middleware like MQ message queues, pure installation of the software is only half a day, and the rest is service deployment and debugging.

1. Prepare the required software package first (in order to keep the software version as consistent as possible with the pre-release and live network environment) and put all the installation packages in the opt directory. How did the package get into the Linux system? The following three methods are available: First, wget download address will download to the current directory, second, download local, then use XFTP to connect the server tool to upload to the Linux specified directory data, third, still download local. Yum -y install LRZSZ yum -y install LRZSZ

JDK1.8, Nginx1.9, Tomcat8.0, Jenkins2.156, Nodejs11.5, Maven3.5, Redis2.8, MySQL5.7, MongoDB3.2.1

2. Install software in random order. MongoDB is installed first and also the first time (all subsequent actions start from opt directory by default) :

[root@localhost opt]$ tar zxvf mongodb.tgz [root@localhost opt]$ mv * /data/mongodb [root@localhost opt]$ vim MONGODB_HOME="/data/mongodb" PATH=$PATH:$mongodb /bin [root@localhost opt]$source /etc/profile [root@localhost opt]$ mkdir -p /data/mongodb/db /data/logs/mongodb [root@localhost opt]$ vim /etc/mongod. Conf Db path logpath = / data/logs/mongo/mongod log [root @ localhost bin] $. / mongod - f/etc/mongod. Conf # start the mongo database [root@localhost opt]$vim /etc/mongod.conf "Enabled" mongodb > db.createuser ({user:"root", PWD :" password ",roles:["root"]}); Mongodb > db.auth("root"," your password "); Decompress the installation package from the /opt temporary file, move mv to the /data/ directory, and configure environment variables, MongoDB configuration, and account password. Database user roles: read and readWrite. 2. Database management roles: dbAdmin, dbOwner, and userAdmin; 3. Cluster management roles: clusterAdmin, clusterManager, clusterMonitor, and hostManager. 4. Backup and restore roles: Backup and restore. 5. All database roles: ReadAnyDatabase, readWriteAnyDatabase, userAdminAnyDatabase, dbAdminAnyDatabase // There are several other roles that indirectly or directly provide access to the system superuser (dbOwner) , userAdmin, userAdminAnyDatabase)Copy the code

3, install mysql painful memory, I remember when I was playing mysql installation in Linux system, it took a month to install mysql successfully, all kinds of Baidu information, really embarrassed, finally try to install get prompts: Mysql > install mysql > install mysql > install mysql > install mysql

[root@localhost opt]$tar ZXVF mysql5.7 [root@localhost opt]$mv * /data/mysql [root@localhost opt]$groupadd mysql [root@localhost opt]$ useradd -r -g mysql mysql [root@localhost mysql]$ mkdir -p /var/lib/mysql [root@localhost mysql]$ chown -R mysql:mysql /var/lib/mysql [root@localhost mysql]$ ./bin/mysqld --user=mysql --basedir=/data/mysql --atadir=/var/lib/mysql --initialize [root@localhost opt]$vim /etc/my.cnf #[mysqld [root@localhost opt]$service mysqld start #mysql service start [root@localhost opt]$./bin/mysql -u root -p ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement. mysql> alter user 'root'@'localhost' identified by 'your password '; mysqld_safe error: log-error set to '/var/log/mariadb/mariadb.log', however file don't exists. Create writable for user 'mysql'. touch /var/log/mariadb/mariadb.log chown -R mysql:mysql /var/log/mariadb/ /usr/local/mysql/bin/mysqld: Can't create/write to file '/var/run/mariadb/mariadb.pid' (Errcode: 2 -no such file or directory) chown -r mysql:mysql /var/run/mariadb/ mysql. Sock problem (3):Can't connect to local mysql server through socket '/tmp/mysql.sock' (2) ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sockCopy the code

4, in addition to their often deployed JDK, Tomcat, nginx, Apache, mysql, PHP, Maven, Ant, Jmeter, Jenkins and other environments, Redis, MongoDB, nodeJS are installed for the first time, install the test environment, install more will be familiar with. Only hand familiar before Posting the Redis installation steps:

[root@localhost opt]$tar ZXVF redis2.8 unzip [root@localhost opt]$mv redis2.8 /data/redis [root@localhost opt]$yum install gcc cpp binutils glibc glibc-kernheaders glibc-common glibc-devel fatal error: jemalloc/jemalloc.h: No such file or directory [root@localhost data]$ yum install tcl [root@localhost data]$ make && make test [root@localhost data]$make install # Enter SRC directory [root@localhost bin]$./redis-server & [root@localhost bin]$./redis-server  /data/redis/etc/redis.conf 1. Access the redis root directory CD /usr/local/redis-2.8.19 2. Log in to redis: redis-cli -h 127.0.0.1 -p 6379 5 Flush data from the entire Redis server: flushallCopy the code

5, JDK installation, decompress, do not need to compile, just configure environment variables:

[root@localhost opt/]$tar ZXVF jdk1.8. TGZ # $root@localhost opt/]$mv JDK /usr/local/jdk1.8 [root@localhost opt/]$ JAVA_BIN=/usr/local/jdk1.8/bin JRE_HOME=/usr/local/jdk1.8/jre PATH=$PATH:$JAVA_BIN:$JRE_HOME/bin CLASSPATH=$JRE_HOME/lib:$JAVA_HOME/lib:$JRE_HOME/lib/charsets.jar export JAVA_HOME JRE_HOME JAVA_BIN PATH CLASSPATH [root@localhost opt/]$source /etc/profile # Effective [root@localhost opt/]$java-version This is a version of the Windows operating system, which can be used in Linux. Java version "1.8.0_20" Java(TM) SE Runtime Environment (build 1.8.0_20-B26) Java HotSpot(TM) 64-bit Server VM 25.20 b23 (build, mixed mode)Copy the code

6, Nginx installation

[root@localhost opt/]$ yum -y install  zlib zlib-devel gcc-c++ libtool  openssl openssl-devel  pcre*

[root@localhost nginx/]$ ./configure --prefix=/usr/local/nginx_test --conf-path=/usr/local/nginx/conf/nginx.conf --with-http_ssl_module  --with-http_stub_status_module --with-pcre 

[root@localhost nginx/]$ make &&  make install

[root@localhost nginx/]$ ./sbin/nginx -t  

[root@localhost opt/]$ vim /etc/profile

    PATH=$PATH:$NGINX_HOME/sbin

[root@localhost opt/]$ source /etc/profile
Copy the code

7. Tomcat installation is as follows:

[root@localhost opt ]$ tar zxvf tomcat.tgz [root@localhost opt ]$ mv apache-tomcat /data/tomcat8 [root@localhost opt ]$ cp -p /data/tomcat8/bin/catalina.sh /etc/init.d/tomcat [root@localhost opt ]$ vim /data/tomcat8/conf/tomcat-user.xml <user name="" password="" "rolesname="" /> [root@localhost opt]$vim /etc/init.d/tomcat To add the chkconfig service to the list: JAVA_HOME=/usr/local/ jdk1.8/CATALina_HOME =/data/tomcat8 [root@localhost opt ]$ chmod 755 /etc/init.d/tomcat [root@localhost opt ]$ chkconfig --add tomcat [root@localhost opt ]$ Service tomcat start # Start the Tomcat serviceCopy the code

Java-jar Jenkins. War –httpPort=8090

Install Nodejs for the first time. Unzip the file, move it to the specified directory, and create a soft link:

[root@localhost opt]$tar xf node-v11.5.0-linux-.armv7.tar -c /usr/local/nodejs [root@localhost opt]$CD /usr/local/ [root @ localhost opt] $mv node - v5.10.1 - Linux - x64 / nodejs [root @ localhost opt] $ln -s/usr/local/nodejs/bin/node/usr/bin [root@localhost opt]$ ln -s /usr/local/nodejs/bin/npm /usr/binCopy the code

10. Final Maven deployment:

[root@localhost opt]$tar ZXVF maven3.5. TGZ [root@localhost opt]$mv /usr/local/maven [root@localhost opt]$vi /etc/profile MAVEN_HOME=/usr/local/maven PATH=$PATH:$MAVEN_HOME/bin [root@localhost opt]$ source /etc/profileCopy the code

11, the entire test environment requires software to complete the smooth installation, and there is no difficult appearance, one-time installation, without pauses.