Linux ------ environment configuration (CentOS 7) installed JDK Tomcat Nginx MySQL

mkdir: create directory rmdir: delete the directory pwd: lists the current directory

Note:

Set Language: LANG = "zh_CN.UTF-8" LANG = "en_US.UTF-8"

 !!! pay attention Tencent cloud security group has no open ports

 

Detailed answers Linux file structure: https: //www.cnblogs.com/irisrain/p/4201947.html

Detailed Linux directory: https: //blog.csdn.net/m0_38044196/article/details/72844025

Linux command to query Web site: https: //www.linuxcool.com/

To install the software into what is good: https: //blog.csdn.net/aqxin/article/details/48324377

 Do not understand the first time, found on the Internet, the jdk installed to / usr, and later found the tomcat installed to / usr / local, and finally found maven installed to / usr / local / bin, but like a used bin directory store commands, so you where to put it at will

 

linux: rights management; software installation

Installation environment: the JDK; Tomcat; Maven; Vsftpd; Nginx; file server; MySQL; Git; iptables: firewall; automated script released

 

安装jdk:https://blog.csdn.net/zilch_wolf/article/details/80379383       https://cloud.tencent.com/developer/article/1341059

1 check not installed jdk:

java -version // or rpm -qa | grep jdk

 Download rpm package 2: need to check the download link (download required because authenticated login have a AuthParam parameter) in the request header; downloaded to the directory where the installation package to view du -h will show installation package size

wget https://download.oracle.com/otn/java/jdk/8u221-b11/230deb18db3e4014bb8e3e8324f81b43/jdk-8u221-linux-x64.rpm?AuthParam=1569377150_3eb0bfdd95c7b7ec1ac0050fd5d0a077

 3 installation package Rename: Original name (jdk-8u221-linux-x64.rpm AuthParam = 1569377150_3eb0bfdd95c7b7ec1ac0050fd5d0a077?)

mv jdk-8u221-linux-x64.rpm?AuthParam=1569377150_3eb0bfdd95c7b7ec1ac0050fd5d0a077 jdk-8u221-linux-x64.rpm

 4 Install the rpm package: command: rpm -ivh packge.rpm installed by default to: /usr/java/jdk1.8.0_221-amd64

rpm -ivh jdk-8u221-linux-x64.rpm

 5 modify the configuration file vim / etc / profile: The last side to add in the configuration file, and then Esc +: wq to save and exit; press note was in English: wq

#set java environment 
 JAVA_HOME=/usr/java/jdk1.8.0_221-amd64
 JRE_HOME=/usr/java/jdk1.8.0_221-amd64/jre
 CLASS_PATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib
 PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin
 export JAVA_HOME JRE_HOME CLASS_PATH PATH

 6 Let configuration to take effect source / etc / profile; check whether the installation was successful java -version

 

Install Tomcat : https://blog.csdn.net/zhuying_linux/article/details/6583096

Check whether the installation Tomcat: RPM -qa | grep Tomcat // tried, since the order did not seem to effect, the problem may be named

1 download tomcat: created in / usr / local folder tomcat, download the file and unzip:

httpsmirrorstunatsinghuaeducnapachetomcattomcat8v8546binapachetomcat8546targz programs wget 

tar zxvf apache-tomcat-8546 .tar.gz

 

Character Set 2: tomcat to installation conf folder, edit server.xml; / 8080 8080 to find, add URIEncoding = "UTF-8" node in xml

cd /usr/local/tomcat/apache-tomcat-8.5.46

    <Connector port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />

 

3 configuration environment variable:

vim / etc / Profile 

// add at most below 
#set Tomcat 
Export CATALINA_HOME = / usr / local / Tomcat / the Apache-Tomcat-8.5.46

 

4 Verify Tomcat: the tomcat bin folder for the installation, perform ./startup.sh.

cd  /usr/local/tomcat/apache-tomcat-8.5.46/bin
./startuop.sh
./shutdown.sh

 

Installation maven: installation maven: https: //blog.csdn.net/l05199179/article/details/78982212 modify the local repository: https: //blog.csdn.net/libaowen609/article/details/81625891

1 Download and unzip:

// download 
wget https://mirrors.tuna.tsinghua.edu.cn/apache/maven/maven-3/3.6.2/binaries/apache-maven-3.6.2-bin.tar.gz 
// decompress 
tar -zxvf apache-maven-3.6.2-bin.tar.gz

 

 2 configuration environment variable:

// enter the configuration file 
vim / etc / Profile 
// add configuration information 
Export MAVEN_HOME = / usr / local / bin / Maven / the Apache Maven-3.6.2- 
// add MAVEN_HOME in the PATH 
the PATH = $ the PATH: $ JAVA_HOME / bin: $ JRE_HOME / bin: $ MAVEN_HOME / bin

3 make the configuration take effect source / etc / profile, and verify mvn -version

4 Modify the local repository: https://blog.csdn.net/libaowen609/article/details/81625891

<localRepository>/usr/local/bin/maven/repository</localRepository>

 

vsftpd service : Look at this one: https:. //www.itgeeker.net/centos6-5-64bit-how-to-install-vsftpd/ https://blog.csdn.net/will0532/article/details/79175478

rpm -qa | grep vsftpd check whether the installation related connection  https://blog.csdn.net/will0532/article/details/79175478        https://blog.csdn.net/somehow1002/article/details/70232791

Note: vsftpd get more than six hours, or did not get success: If you simply want to transfer files, you can connect to the server with IDEA: https://blog.csdn.net/qq_40074764/article/details/79965268

Probably this question: https://www.cnblogs.com/chencongcong/p/9956778.html broken question is this: https: //blog.csdn.net/qq_26441253/article/details/53339083

 

The project to use the configuration items: 
. 1) local_root = / ftpfile (when a local user login, change to be defined under the directory, the default value for each user's home directory) 
2) = anon_root / ftpfile (anonymous login using when the sign of the directory) 
. 3) use_localtime = YES (the default time is GMT, using the system time change) 
. 4) anonymous_enable = NO (anonymous login allowed) 
. 5) local_enable = YES (allow local users log) 
6 ) write_enable = YES (local users can read and write in their own home directory) 
7) local_umask = 022 (the umask value when the new local user file) 
8) dirmessage_enable = YES (If you enable this option, then the user first when times into a directory, it will check whether there .message this file in the directory, and if so, the contents of this file occurs, this file will be placed usually welcome words, or the description of the catalog. the default is open) 
9) xferlog_enable = YES (whether upload / download logging is enabled. If enabled, the upload and download of information will be a complete record in the file xferlog_file defined in. default Open.) 
10) connect_from_port_20 = YES (using the specified FTP data transfer port 20, the default value is YES) 
. 11) = xferlog_std_format is YES (if enabled, will be written in the log file format standard xferlog)  
12 is) available for purchase to ftpd_banner = mmall FTP Server (where the string is used to define the welcome discourse)
13 is) chroot_local_user = NO (with to specify a user list file the user is allowed to switch to the parent directory) 
14) chroot_list_enable = YES chroot_list_file user list file specified configuration item (to enable or disable) 
15) = chroot_list_file / etc / the vsftpd / chroot_list (used to specify a list of users file) 
16) listen = YES (set vsftpd server is running in standalone mode, running in standalone mode is a good way to listen this time must be set to YES, this is the default value is not recommended change, there are a lot of running and server configuration commands, you need to be effective in this mode, if set to NO, then vsftpd is not an independent service runs, subject to control xinetd service is limited) functionality 
17) pam_service_name = vsftpd (PAM virtual user authentication, set up here is the name used by PAM, the default, and /etc/pam.d/vsftpd correspondence) userlist_enable = YES (whether vsftpd.user_list files, blacklist, whitelist are enabled can 
18) pasv_min_port = 61001 (passive mode using the port range minimum value) 
. 19) pasv_max_port = 62000 (passive Mode uses the port range maximum) 
20 is) pasv_enable = YES (pasv_enable = YES / NO (YES) 
when set to YES, the operation mode using PASV; if set to NO, the default value is used PORT mode YES, i.e., to use PASV. working mode 
   FTP protocol has two modes: PORT mode and PASV mode, Chinese meant to active and passive.
   A connecting process PORT (active) mode are: FTP client to the server port (default 21) transmits a connection request, the server accepts the connection, establishing a link command. 
  When you need to transfer data, the client tells the server on the command link with the PORT command: "I opened **** port, you connect me to come." Thus the transmission from server to client port 20 **** port connection request to establish a data link to transmit data. 
   Second, the process of connecting the PASV (passive) mode are: FTP client to the server port (default 21) transmits a connection request, the server accepts the connection, establishing a link command. 
  When you need to transfer data, the server on the command link tells the client to use PASV command: "I opened **** port, you connect me to come." Thus **** client sends the server port connection request to establish a data link to transmit data. 
  As can be seen from the above, two ways command link connection method is the same, and method for establishing a data link is completely different. The complexity of the FTP in this. 
)

 

1 Installation:

yum -y install vsftpd // - y (the installation process when prompted to select all "yes")

2 Create a virtual user:; 3 user and folder permissions correspond chown -R ftpuser.ftpuser / ftpfile; 4 ftpuser password reset

Create a folder in the root directory: used to upload files

mkdir ftpfile

Adding an anonymous user: only operate ftpfile, no permission to log on linux ,, there will be a warning: the home directory already exists

// add user 
useradd ftpuser -d / ftpfile -s / sbin / nologin 
// give permission: command finishes ll view the file information: drwxr-XR-2 ftpuser ftpuser the X-4096 Sep 26 16:26 [NASB] ftpfile 
chown -R ftpuser.ftpuser / ftpfile / 
// password: ..13 
passwd ftpuser

 

3 Configuration: // default configuration file /etc/vsftpd/vsftpd.conf

// Display Command and related documents 
whereis vsftpd ----------> vsftpd: / usr / sbin / vsftpd / etc / vsftpd /usr/share/man/man8/vsftpd.8.gz 
// into the configuration file: 
vim /etc/vsftpd/vsftpd.conf 
// search 
/ banner ----> You can modify the welcome message, ftpd_banner = Welcome to mmall FTP Server ( here used to define the welcome words of the string) specific see above configuration source

 

// Input 
1) local_root = / ftpfile (when a local user login, change to be defined under the directory, the default value for each user's home directory) 
2) anon_root = / ftpfile (anonymous login used, the directory sign ) 
3) use_localtime = YES (default is GMT time into using the system time) 
// search to this, and turn off anonymous access 
4) anonymous_enable = NO (do not allow anonymous user login) 

// Search: chroot_list_enable then remove comments 
14) chroot_list_enable = YES (whether to enable the user list file specified chroot_list_file CI) 
15) = chroot_list_file / etc / the vsftpd / chroot_list (used to specify a user list file) 

// input: modify the port range 
18) pasv_min_port = 61001 (passive mode using port range minimum) 
19) pasv_max_port = 62000 (passive mode using port range maximum) 

to save and exit: to: / etc / vsftpd created: chroot_list file, add users inside: ftpuser

4 Firewall Configuration: https://blog.csdn.net/yyycheng/article/details/79753032 https://blog.csdn.net/u013410747/article/details/61696178  

//
cd /etc/firewalld/zones
vim public.xml

<port protocol="tcp" port="20"/>
<port protocol="tcp" port="21"/>

 

// start the Firewall 
Service firewalld Start 
// restart 
Service firewalld restart 
// Close 
Service firewalld STOP 

// Check the firewall open port rules 
Firewall-cmd --list-All 

# query port is open 
firewall-cmd --query-port = 8080 / TCP 
# 80 open ports 
firewall --permanent --add-port-cmd = 80 / TCP 
# removal port 
firewall --permanent --remove-port-cmd = 8080 / TCP 


# restart firewall (firewall modified configured to restart ) 
firewall-cmd --reload 

# of parameters 
1, firwall-cmd: the operation is a tool provided for Linux firewall; 
2, - Permanent: provided persistent represented; 
. 3, - the Add-port: port identification added;

 This version is 7 or less CentOS: vim / etc / sysconfig / iptables -A INPUT -p TCP --dport 61001: 62001 -j ACCEPT other configuration information; reboot the firewall: service ipiptables restart

#vsftpd
-A INPUT -p TCP --dport 61001:62001 -j ACCEPT 
-A INPUT -p TCP --sport 61001:62001 -j ACCEPT

-A INPUT -p TCP --dport 20 -j ACCEPT 
-A INPUT -p TCP --dport 20 -j ACCEPT

-A INPUT -p TCP --dport 21 -j ACCEPT 
-A INPUT -p TCP --dport 21 -j ACCEPT

Verify vsftpd: restart: service vsftpd restart start: service vsftpd start shut down: service vsftpd stop

 

Nginx installation: https://www.cnblogs.com/jimisun/p/8057156.html

cd / usr / local / nginx / sbin / 

// start 
./nginx 

// stop: first find nginx process id and then use the kill command to force kill the process 
./nginx -s STOP 

 // nginx process to be carried out to stop processing task is completed 
-s quit ./nginx 

// restart 
./nginx -s reload

Nginx configuration:

// enter the Nginx configuration file conf 
cd / usr / local / nginx / conf 
// Create a folder to store a configuration file 
mkdir vhost 
// modify nginx.conf file 
vim nginx.conf 
// add include vhost / * conf;. Meaning : the vhost folder inside the * .conf file add to the mix at the end of 
the include vhost / * conf;. 

// in vhost add: img.anitano.cn.conf forwards the request to file: / product / ftpfile / img / folder 
Note! ! ! : Autoindex off; off automatic indexing; autoindex on turn automatic indexes: The effect http://learning.happymmall.com/
Server { the listen 80; Server { the listen 80; autoindex OFF; server_name img.anitano.com; access_log / usr / local / Nginx / logs / Combined the access.log; index the index.jsp the index.php index.html index.htm; #error_page 404 /404.html; IF (QUERY_STRING $ ~ * "* [\; '\ <\>].. *") { return 404; } location ~ /(mmall_fe|mmall_admin_fe)/dist/view/* { deny all; } location / { root /product/ftpfile/img/; add_header Access-Control-Allow-Origin *; } }

 

 

Install MySQL: https://www.cnblogs.com/Twobox/p/9925460.html https://blog.csdn.net/qq_23167527/article/details/85236999 // special attention to download to your CentOS system corresponding rpm packagemysql-8.0.13-1.el7.x86_64.  如:e7:7.x 系统

"" The first tutorial to see the first half, the second half after watching the tutorial

Solve the glibc version is too low: When you download MySQL, use the system to match the source RPM, to download the corresponding system version of MySQL http://www.cnzui.com/archives/1253

 

 Uninstall error when installing MySQL dependencies: yum the Remove MySQL-libs

Uninstall one by one rpm -e package name

After uninstalling you can view the installation:rpm -qa|grep -i mysql

 The results show the installation of the installation depends on there not being given, not silly bulkhead installation

After the installation is complete initial configuration: 

1 Create the root user:

cat /var/log/mysqld.log View Temporary Password Forgot your password: https: //blog.csdn.net/yi247630676/article/details/80352655

设置密码:alter USER 'root'@'localhost' IDENTIFIED BY '新密码(必须包含:数字大小写字母特殊字符)';

 Character Set: Set the character set may be different between different versions

 

2 Delete anonymous users

select user, host from mysql.user; # queries users 
delete from mysql.user where user = '' ; # delete user 
flush privileges

 

3 Create a normal user

create user 'quanran'@'%' identified by 'QuanRan123:';
例如:create user 'eshop'@'localhost' IDENTIFIED BY 'Yang134679.';

 

4 Import Database

5 to the accounts opened in various jurisdictions: CRUD rights

 

  Exit: quit

Guess you like

Origin www.cnblogs.com/Lemonades/p/11578457.html