Home PC Games Linux Windows Database Network Programming Server Mobile  
  Home \ Server \ CentOS 7 server environment to quickly build Linux     - How to configure FirewallD in RHEL / CentOS 7 and Fedora in (Linux)

- How to fix Not Enough Free Disk Space On / boot on Ubuntu (Linux)

- C ++ 11 feature: decltype keywords (Programming)

- Minimum period string problem (Programming)

- Redis Linux system installation guide (Database)

- Multipath configuration under Linux (Linux)

- Zabbix installation and configuration process (Server)

- Resolve the host via KVM console can not connect clients (Linux)

- Drawing from the Android source code analysis View (Programming)

- Depth understanding of C language (Programming)

- How SSHfs mount a remote file system on Linux (Linux)

- Setting up Linux machine through a proxy firewall (Linux)

- OpenGL Superb Learning Notes - Depth Texture and Shadows (Programming)

- RAID configuration and management under linux (Server)

- How to compare PDF files on Ubuntu (Linux)

- Django how to generate content in non-HTML formats (Programming)

- MySQL fuzzy query: LIKE and REGEXP pattern mode (Database)

- Kafka cluster deployment (Server)

- MySQL various log summary (Database)

- systemd Power Management (Linux)

  CentOS 7 server environment to quickly build Linux
  Add Date : 2018-11-21      
  Based on CentOS operating system how to quickly build including GIT, Maven, Tomcat, Java, MySQL and Nginx services environment, how to frame scaffold frame based YMP tools to quickly create separate the JVM Tomcat service.

Recently the company's Windows server frequently caught, and could not stand, and thus decided to switch to Linux system! Now while the server is scanned for viruses, the configuration process later today Ali cloud server sort out quickly erected write a manual environment, share with small partners!


This article describes the following services installed in CentOS 7 operating system:

Installation GIT

Ali cloud CentOS mirror has been installed by default Git v1.8.3.1, if not installed execute the following command:

// Installation through yum
yum install git
// Check Git version
git --version
Installing Maven

// Download Maven installation package
wget http://apache.fayea.com/maven/maven-3/3.3.3/binaries/apache-maven-3.3.3-bin.tar.gz
// Decompression
tar zxvf apache-maven-3.3.3-bin.tar.gz
Install Tomcat

// Download Tomcat installation package
wget http://apache.fayea.com/tomcat/tomcat-7/v7.0.64/bin/apache-tomcat-7.0.64.tar.gz
// Decompression
tar zxvf apache-tomcat-7.0.64.tar.gz
Install Java

// Access the official website http://www.Oracle.com/technetwork/java/javase/downloads/index.html
// Download Java installation package (the first after the machine to start the download, and then copy the download link address)
wget http://download.oracle.com/otn-pub/java/jdk/8u65-b17/jdk-8u65-linux-x64.tar.gz?AuthParam=1445393430_77c75c42039e71d236a2a146b48c185c
// Decompression
tar zxvf jdk-8u65-linux-x64.tar.gz \? AuthParam \ = 1445393430_77c75c42039e71d236a2a146b48c185c
The above operation has been Git, Maven, Tomcat and Java are ready, then configure the environment variables:

// Edit .bash_profile file
vi ~ / .bash_profile
After modify the file as follows:

# Get the aliases and functions
if [-f ~ / .bashrc]; then
        . ~ / .bashrc

# User specific environment and startup programs

JAVA_HOME = / root / jdk1.8.0_65
MAVEN_HOME = / root / apache-maven-3.3.3

PATH = $ PATH: $ HOME / bin: $ JAVA_HOME / bin: $ MAVEN_HOME / bin

export CLASSPATH =:. $ JAVA_HOME / lib / dt.jar: $ JAVA_HOME / lib / tools.jar

export JAVA_TOOL_OPTIONS = -Dfile.encoding = UTF-8
export MAVEN_OPTS = -Dfile.encoding = UTF-8

export JAVA_HOME

export PATH
Do not forget to save the file about the implementation to take effect

// Perform source
source .bash_profile
Environment variables configured, you can verify it:

// Excuting an order
java -version
// Output
java version "1.8.0_65"
Java (TM) SE Runtime Environment (build 1.8.0_65-b17)
Java HotSpot (TM) 64-Bit Server VM (build 25.65-b01, mixed mode)

// Excuting an order
mvn -version
// Output
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding = UTF-8
Apache Maven 3.3.3 (7994120775791599e205a5524ec3e0dfe41d4a06; 2015-04-22T19: 57: 37 + 08: 00)
Maven home: /root/apache-maven-3.3.3
Java version: 1.8.0_65, vendor: Oracle Corporation
Java home: /root/jdk1.8.0_65/jre
Default locale: zh_CN, platform encoding: UTF-8
OS name: "linux", version: "3.10.0-123.9.3.el7.x86_64", arch: "amd64", family: "unix"
Well, so far we have configured Java, Maven environment, then we began to build Tomcat service, we can think of, and then download the installation package can be unpacked, No!

Today I want to elaborate a Tomcat is how to build a more independent JVM Tomcat service, let's get started!

// Create a directory to store bar code
mkdir ~ / workspaces
// By Git source code download YMP v1
cd ~ / workspaces /
git clone http://git.oschina.net/suninformation/ymateplatform.git
// The download is complete, then compile and install by Maven
cd ymateplatform /
mvn install
Well, after a while Luangun screen, then the entrees, we created the first Tomcat service

// Create a directory to hold our Tomcat service files
mkdir ~ / servers
// Enter the YMP project directory
cd ymateplatform /
// Execute the following command, where:
// Catalina.home parameter: specify the location of Tomcat package
// Catalina.base parameters: Specify generated Tomcat service storage location
// Tomcat.version parameter: specify the version Tomcat package, YMP currently supports two versions 6 and 7
// Host.name parameter: Specifies the name of the Tomcat service is generally set to the domain name
// Host.alias parameters: alias Tomcat service
// Service.name parameters: Windows environment specified service name registration
// Server.port parameter: Specifies the Tomcat Server port services
// Connector.port parameters: Specify Tomcat Connector port services
// Redirect.port parameter: Specifies the Tomcat Redirect Port services
// Ajp.port parameter: Specifies the Tomcat AJP port services
mvn compile exec: java -Dexec.mainClass = "net.ymate.platform.extra.scaffold.TomcatServScaffold" -Dcatalina.home = "/ root / apache-tomcat-7.0.64" -Dcatalina.base = "/ root / servers / demoServ "-Dtomcat.version =" 7 "-Dhost.name =" www.ymate.net "-Dhost.alias =" ymate.net "-Dservice.name =" demoServ "-Dserver.port =" 8005 "- Dconnector.port = "8080" -Dredirect.port = "8443" -Dajp.port = "8009"
After a while the screen is Luangun, the following output:

[INFO] --- exec-maven-plugin: 1.4.0: java (default-cli) @ ymate-platform ---
log4j: WARN No appenders could be found for logger (freemarker.cache).
log4j: WARN Please initialize the log4j system properly.
Output file: /root/servers/demoServ/conf/server.xml
Output file: /root/servers/demoServ/vhost.conf
Output file: /root/servers/demoServ/bin/install.bat
Output file: /root/servers/demoServ/bin/manager.bat
Output file: /root/servers/demoServ/bin/shutdown.bat
Output file: /root/servers/demoServ/bin/startup.bat
Output file: /root/servers/demoServ/bin/uninstall.bat
Output file: /root/servers/demoServ/bin/manager.sh
Output file: /root/servers/demoServ/webapps/ROOT/index.jsp
[INFO] ----------------------------------------------- -------------------------
[INFO] ----------------------------------------------- -------------------------
[INFO] Total time: 5.591 s
[INFO] Finished at: 2015-10-21T22: 41: 02 + 08: 00
[INFO] Final Memory: 11M / 26M
[INFO] ----------------------------------------------- -------------------------
Congratulations, we first create a Tomcat service a success! Let's look at the generated directory structure:

cd ~ / server / demoServ
ls -al
// Output:
drwxr-xr-x 8 root root 4096 at 10:42 on October 21.
drwxr-xr-x 5 root root 4096 at 22:41 on October 21 ..
drwxr-xr-x 2 root root 4096 10 21 10:42 bin Yue
drwxr-xr-x 3 root root 4096 10 Yue 21 10:52 conf
drwxr-xr-x 2 root root 4096 10 Yue 21 10:52 logs
drwxr-xr-x 2 root root 4096 10 Yue 21 10:42 temp
-rw-r - r-- 1 root root 560 10 Yue 21 10:42 vhost.conf
drwxr-xr-x 3 root root 4096 10 Yue 21 10:42 webapps
drwxr-xr-x 3 root root 4096 10 Yue 21 10:52 work
And Tomcat is not the same as it's own directory structure, yes, all the files will be in service demoServ stored here, and Tomcat software package isolated. Here more a vhost.conf document, which has been written for you to integrate Tomcat with Apache Server configuration needed, :) YMP not intimate? !

Well, let us start to see results demoServ service, etc ... one step short of Oh!

// Look at demoServ / bin directory files
cd ~ / server / demoServ / bin
ls -al
drwxr-xr-x 2 root root 4096 at 10:42 on October 21.
drwxr-xr-x 8 root root 4096 at 10:42 on October 21 ..
-rw-r - r-- 1 root root 431 10 Yue 21 10:42 install.bat
-rw-r - r-- 1 root root 455 10 Yue 21 10:42 manager.bat
-rwxr - r-- 1 root root 345 10 Yue 21 10:42 manager.sh
-rw-r - r-- 1 root root 401 10 Yue 21 10:42 shutdown.bat
-rw-r - r-- 1 root root 401 10 Yue 21 10:42 startup.bat
-rw-r - r-- 1 root root 432 10 Yue 21 10:42 uninstall.bat
Because we Linux system, you only need enough manager.sh file, the other files are in Windows will be used. Now, we need to manager.sh file executable permissions:

chmod + x manager.sh
OK, let me start demoServ service it!

// Execute start command
./manager.sh start
// Output
Using CATALINA_BASE: / root / servers / demoServ
Using CATALINA_HOME: /root/apache-tomcat-7.0.64
Using CATALINA_TMPDIR: / root / servers / demoServ / temp
Using JRE_HOME: /root/jdk1.8.0_65
Using CLASSPATH: /root/apache-tomcat-7.0.64/bin/bootstrap.jar:/root/apache-tomcat-7.0.64/bin/tomcat-juli.jar
Using CATALINA_PID: /root/servers/demoServ/logs/catalina.pid
Tomcat started.
Starts successfully, quickly open the browser to access the URL http: // your domain name or IP address: 8080 / try! Create more Tomcat service, according to the process just to do it again!

PS: manager.sh command are as follows:

Usage: manager.sh (commands ...)
  debug Start Catalina in a debugger
  debug -security Debug Catalina with a security manager
  jpda startStart Catalina under JPDA debugger
  run Start Catalina in the current window
  run -security Startin the current window with security manager
  startStart Catalina in a separate window
  start -security Startin a separate window with security manager
  stopStop Catalina, waiting up to5 seconds for the process toendstop n Stop Catalina, waiting up to n seconds for the process toendstop -forceStop Catalina, wait up to5 seconds andthenusekill -KILLif still running
  stop n -forceStop Catalina, wait up to n seconds andthenusekill -KILLif still running
  configtest Run a basic syntax checkonserver.xml - check exit code for result
  version What versionof tomcat are you running?
Continue, not over yet: p

Installing MySQL

// Get back to the old place
cd ~
// Download the official installation package file
wget http://dev.mysql.com/get/Downloads/MySQL-5.6/MySQL-5.6.27-1.linux_glibc2.5.x86_64.rpm-bundle.tar
// Decompression
tar xvf MySQL-5.6.27-1.linux_glibc2.5.x86_64.rpm-bundle.tar
// Start the installation package
rpm -ivh MySQL-client-5.6.27-1.linux_glibc2.5.x86_64.rpm
rpm -ivh MySQL-devel-5.6.27-1.linux_glibc2.5.x86_64.rpm
rpm -ivh MySQL-embedded-5.6.27-1.linux_glibc2.5.x86_64.rpm
rpm -ivh MySQL-shared-5.6.27-1.linux_glibc2.5.x86_64.rpm
rpm -ivh MySQL-shared-compat-5.6.27-1.linux_glibc2.5.x86_64.rpm
rpm -ivh MySQL-test-5.6.27-1.linux_glibc2.5.x86_64.rpm
// Since CentOS comes mariadb package and MySQL packages conflict, you need to uninstall
rpm -qa | grep -i mariadb
yum remove mariadb-libs.x86_64
// Continue the installation
rpm -ivh MySQL-server-5.6.27-1.linux_glibc2.5.x86_64.rpm
// Installed, since I use the root user, so MySQL users are using a root and generate a random password
// Check the generated random password
cat /root/.mysql_secret
// Start the MySQL service
service mysql start
// Initialize the next complete MySQL services
// Excuting an order:
/ Usr / bin / mysql_secure_installation


In order to log into MySQL to secure it, we'll need the current
password for the root user. If you've just installed MySQL, and
you have not set the root password yet, the password will be blank,
so you should just press enter here.

// Generate random passwords entered here
Enter current password for root (enter for none):
OK, successfully used password, moving on ...

Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.

You already have a root password set, so you can safely answer 'n'.

// Asked whether you need to change the root password here Confirm and enter the new password twice,
Change the root password? [Y / n]
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables ..
 ... Success!

By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.

// Question whether to remove anonymous user access, press Enter
Remove anonymous users? [Y / n]
 ... Success!

Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone can not guess at the root password from the network.

// Question whether to disable the root account remote login, press Enter
Disallow root login remotely? [Y / n]
 ... Success!

By default, MySQL comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.

// Question whether to remove test database, press Enter
Remove test database and access to it? [Y / n]
 - Dropping test database ...
 ... Success!
 - Removing privileges on test database ...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
It will take effect immediately.

// Reload, press Enter, the configuration is complete!
Reload privilege tables now? [Y / n]
 ... Success!

All done! If you've completed all of the above steps, your MySQL
installation should now be secure.

Thanks for using MySQL!

// Log MySQL quickly try it!
mysql -u root -p
Install Nginx

// Check Nginx yum package on the older version is 1.6
yum info nginx
// According Nginx official documents, install the latest stable version
// Create a new profile, the command is as follows:
vi /etc/yum.repos.d/nginx.repo
// document content:
name = nginx repo
baseurl = http: //nginx.org/packages/centos/7/$basearch/
gpgcheck = 0
enabled = 1
//: Wq save
// Check again Nginx version 1.8
yum info nginx
// OK, to start the installation
yum install nginx
// Start Nginx
/ Usr / sbin / nginx -c /etc/nginx/nginx.conf
Nginx service installation and configuration is complete, more Nginx command as follows:

// Reload configuration
/ Usr / sbin / nginx -s reload
// Out of service
/ Usr / sbin / nginx -s stop
// Authentication Profiles
/ Usr / sbin / nginx -t -c /etc/nginx/nginx.conf
OK, now on our servers in the service and some have a production environment quickly erected - every minute to get! The contents of introduction, the small partners please try it yourself, please share!
- How to install Zephyr Test Management Tools on CentOS 7.x (Server)
- Depth study and understanding for individual users suicide DDoS attacks (Linux)
- MySQL optimization of the relevant Group By (Database)
- Linux operating system security management skills (Linux)
- On event processing browser compatibility notes (Programming)
- Puppet 3.5 Source package Installation and Configuration (Server)
- How to install web crawler tool in Ubuntu 14.04 LTS: Scrapy (Linux)
- CentOS yum source as the default setting methods in DVD (Linux)
- ASM Disk Space Check (Database)
- Linux --- manual release system cache (Linux)
- Protect against network attacks using Linux system firewall (Linux)
- Optimized to minimize the installation of CentOS 5.8 (Linux)
- Use JMS listener Oracle AQ, trigger the execution of Java programs in the database changes (Database)
- MongoDB Study Notes (1) - Install MongoDB on Windows systems (Database)
- Linux remote landing system (Linux)
- VNC configuration detailed analysis under Linux (Linux)
- Ora-00439: feature not enabled: managed standby (Database)
- Installation CD audio file extraction tool Flacon (Linux)
- Shell array: Define Shell array, the array length (Programming)
- Puppet centralized configuration management system (Server)
  CopyRight 2002-2020 newfreesoft.com, All Rights Reserved.