Build linux (centerOS 7) web runtime environment project

First, install the JDK

1. Uninstall the old version or the system comes with the JDK

(1) lists all installed JDK

  rpm -qa | grep jdk

(2) Uninstall unneeded JDK

  yum -y remove installation package

2. Download and extract the JDK

(1) downloads the installation package

  Into the new / usr at / local directory java directory
  mkdir java

  , Using the Java directory wget command to download the installation package, such as

wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8u141-b15/336fa29ff2bb4ef291e347e091f7f4a7/jdk-8u141-linux-x64.tar.gz"

  Or use a good tool to upload to linux shell under local.

(2) extracting installation package

  After downloading use the command to extract,
  tar -zxvf archive name 

3. Set Environment Variables

  Enter / etc / folder using the command vim profile editor to edit the profile file (global environment variable configuration). If there is no profile file, then go to / root .bash_profile configuration files (the current environment variables under User Configuration) in the final document add the following configuration modifications to worry about mistakes :( ps command can be used to back up files)
  export JAVA_HOME = jdk installation package root
  export PATH=$JAVA_HOME/bin:$PATH
  export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/jre/lib/rt.jar
  Do not forget to execute the command
   source /etc/profile
  The configuration file to take effect.
Enter java -version to see JDK configuration is successful. Version information appears JDK installation configuration is complete.

Second, the installation tomcat

2. Download and unzip tomcat

(1) downloads the installation package

  New mywork into usr directory under / / local directory
  mkdir mywork

  , Using wget in command mywork directory download the installation package, such as

  wget "http://mirrors.tuna.tsinghua.edu.cn/apache/tomcat/tomcat-8/v8.5.49/bin/apache-tomcat-8.5.49.tar.gz"
  Or use a good tool to upload to linux shell under local.

(2) extracting installation package

  After downloading use the command to extract,
  tar -zxvf archive name 

3. Start tomcat

  Tomcat into the main directory, start tomcat, use the command

  bin/startup.sh

  Check whether tomcat successfully started (process exists), use the command

  ps -ef | grep tomcat

4. Check whether the installation was successful tomcat 

(1) View firewall status

  systemctl status firewalld
  Use the above command invalid command
  service iptables status

(2) Close linux firewall

  systemctl stop firewalld
  Use the above command invalid command
  service iptables stop

ip address information (3) View of linux

  ifconfig

(4) Access tomcat

  Browser enter the address, http: // ip address: 8080

Third, install mysql

1. Uninstall system comes with a database mariadb

  yum list installed | grep mariadb (see if the system is installed mariadb)

  yum -y remove the application name (Uninstall mariadb)

2. Download and unzip mysql

(1) downloads the installation package

  Into the / usr / local directory, using wget command to download the installation package, such as
  wget "http://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.17-linux-glibc2.5-x86_64.tar.gz"
  Or use a good tool to upload to linux shell under local.

(2) extracting installation package

  After downloading use the command to extract,
  tar -zxvf archive name 
  After the extraction is completed to change the file name,
  mv mysql-extracting file name

3. Create a data warehouse catalog

  mkdir / mysql / data (stored database data directory)

4. Create mysql user and user group

  groupadd mysql (creating user groups)
  useradd -r -s / sbin / nologin -g mysql mysql -d / usr / local / mysql (mysql added to the user group for the user and specify mysql catalog)

5. Specify the directory owner

  Mysql into the root directory
  cd /usr/local/mysql
  Change directory owner,
  chown -R mysql. (Do not forget the back.)
  chgrp -R mysql .
  chown -R mysql /mysql/data

6. initialization configuration parameters mysql

  Performed in the mysql root directory,
  bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/mysql/data
   Note: After the command is executed at the end of the initial password is generated, copy it to Notepad for later first login.
  Setting data encryption,
  bin/mysql_ssl_rsa_setup --datadir=/mysql/data

7. Modify system configuration files

  Add the mysql configuration file to the configuration file into the directory
  cd /usr/local/mysql/support-files
  copy,
  cp my-default.cnf /etc/my.cnf
  cp mysql.server /etc/init.d/mysql
  Edit mysql configuration file, specify the base directory and data directory,
  vim /etc/init.d/mysql
  Modify the following attributes:
  basedir=/usr/local/mysql
  datadir=/mysql/data

8. Change Password

  Start mysql,
  Start /etc/init.d/mysql - 5.0 version is mysqld start
  log in,
  mysql -h localhost -u root -p
  The first input (6) steps to get the password. If there is: -bash: mysql: commond not found on the implementation: ln -s / usr / local / mysql / bin / mysql / usr / bin - Create a soft link command
  change Password,
  set password = password ( 'you want to set a password')

9. The modified host operating authority of the remote user's root

  All rights granted to all hosts
  grant all privileges on *.* to 'root'@'%' identified by 'root';
  Permissions to take effect
  flush privileges;
  View user permissions table
  use mysql;
  select * from user;

10. Add system environment variables

  vim /etc/profile
  At the end add:
  export PATH=/usr/local/mysql/bin:$PATH
  The configuration file to take effect
  source /etc/profile

11. Remote connection test

  Mysql client tool can use a remote connection, the firewall can be turned off when the connection fails retry.

supplement:

  View mysql running,
  service mysql status --5.0 version service mysqld status
  Stop mysql,
  service mysql stop --5.0 version service mysqld stop
  Start mysql
  service mysql start --5.0 version service mysqld start
  Restart mysql
  service mysql restart --5.0 version service mysqld restart
mysql may be configured by modifying the detail /etc/my.cnf.
 

Note: The above step is simple linux operating environment to build the project, if you find errors or improper, welcome message corrections, additions.

 
No mountain six decades, cold do not know of. - Wu Cheng-en, "Journey to the West"
 

Guess you like

Origin www.cnblogs.com/liupenglong/p/11984496.html