Deployment in Linux environment

##################### Install JDK1.7.x ####################

Download the tar package of JDK1.7 (http://www.oracle.com/technetwork/java/javase/archive-139210.html)

1. Unzip to the specified folder

# sudo mkdir /usr/local/java

# sudo tar -zxvf jdk-xxx-linux-x64.tar.gz -C /usr/local/java

2. Set environment variables

# sudo gedit /etc/profile

#set java environment

export JAVA_HOME=/usr/local/java/jdk1.7.0_67

export JRE_HOME=${JAVA_HOME}/jre

export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib

export PATH=${JAVA_HOME}/bin:$PATH

3. Set the default JDK

The display parameter lists all optional commands for a command

# update-alternatives --display java

The config parameter is used to select a link value for a command, which is equivalent to switching among the available values

# update-alternatives --config java

The install parameter is used to add the link value of a command, which is equivalent to adding an available value, where slave is very useful

# update-alternatives –remove java /usr/local/jre1.6.0_20/bin/java

The install parameter is used to add the link value of a command, which is equivalent to adding an available value, where slave is very useful

sudo update-alternatives --install /usr/bin/java java /usr/local/java/jdk1.7.0_67/bin/java 300  

sudo update-alternatives --install /usr/bin/javac javac /usr/local/java/jdk1.7.0_67/bin/javac 300

4. Generally, you need to restart the computer to make it take effect, here use the source command

# source /etc/profile

5. Test

# java -version

 

##################### Install Tomcat7.x ####################

Download from the official website http://tomcat.apache.org/download-70.cgi

apache-tomcat-7.0.69.tar.gz is placed in the specified directory and decompressed

Test whether tomcat starts normally http://ip:8080

 

 

##################### Uninstall Mysql ####################

1. MySQL installed by yum

# yum remove mysql mysql-server mysql-libs compat-mysql51

# rm -rf /var/lib/mysql

# rm /etc/my.cnf

 

Check if there is still mysql software

# rpm -qa|grep mysql

If it exists, continue to delete it.

 

2. mysql installed by rpm

a) Check whether mysql is installed as rpm package in the system

# rpm -qa | grep -i mysql

MySQL-server-5.6.17-1.el6.i686

MySQL-client-5.6.17-1.el6.i686

 

b) uninstall mysql

# rpm -e MySQL-server-5.6.17-1.el6.i686

# rpm -e MySQL-client-5.6.17-1.el6.i686

 

c) delete mysql service

# chkconfig --list | grep -i mysql

# chkconfig --del mysql

 

d) delete the scatter mysql folder

# whereis mysql or find / -name mysql

Delete all folders related to mysql

 

Empty all directories and files related to mysql

rm -rf xxx

 

>>> CentOS 6.5/6.6 install mysql 5.6/5.7 most complete version tutorial<<<

1) Use MySQL's yum warehouse, first download the warehouse suitable for your system from the official website

# http://dev.mysql.com/downloads/repo/yum/

 

2) List of installation warehouses

centos 6.5 corresponds to mysql-community-release-el6-5.noarch.rpm

# yum localinstall mysql-community-release-el6-5.noarch.rpm

 

3) View installable mysql

# yum repolist enabled | grep "mysql.*-community.*"

 

4)

4.1) If you want to install the latest version of mysql

# yum install mysql-community-server

 

4.2) If you choose a version to install, check which versions are available

# yum repolist all | grep mysql

4.2.1) Command installation

# yum-config-manager --disable mysql57-community-dmr

# yum-config-manager --enable mysql56-community

This command is to enable 5.6, disable 5.7 version

4.2.2) Modify the configuration file to install

# vi /etc/yum.repos.d/mysql-community.repo

Set enabled=0 of [mysql55-community], [mysql57-community-dmr], enabled=1 of [mysql56-community]

Execute the installation command

# yum install mysql-community-server

5) Start mysqld

# service mysqld start

 

6) View mysql status

# sudo service mysqld status

 

7) Check whether mysql is self-starting, and set to enable self-starting

# chkconfig --list | grep mysqld

# chkconfig mysqld on

 

8) mysql installation settings

# mysql_secure_installation

 

########### The steps below do not necessarily have ############

9) Modify the character set and data storage path

Configure the /etc/my.cnf file, modify the data storage path, mysql.sock path and the default encoding utf-8.

[client]

password        = 123456

port            = 3306

default-character-set=utf8

[mysqld]

port            = 3306

character_set_server=utf8

character_set_client=utf8

collation-server=utf8_general_ci

#(Note that mysql under linux is installed by default: table names are case-sensitive, column names are not case-sensitive; 0: case-sensitive, 1: case-insensitive)

lower_case_table_names=1

#(Set the maximum number of connections, the default is 151, the maximum number of connections allowed by the MySQL server is 16384; )

max_connections=1000

[mysql]

default-character-set = utf8

 

10) View character set

show variables like '%collation%';

show variables like '%char%';

 

 

##################### Mysql root user password reset####################

 stop mysql service

# service mysqld stop

 

Start mysqld_safe, skipping the startup grant table. The purpose of adding the skip-grant-tables parameter at startup is to not start grant-tables and grant tables when mysql is started. This will allow you to change the root password.

# mysqld_safe --skip-grant-tables &

 

Log in to mysql and change the password:

Password field for version 5.6/5.7: authentication_string

# mysql -uroot -p ----When asking for a password, just press Enter.

> use mysql;

> update mysql.user set authentication_string=password('h5ui') where user='root' and Host = 'localhost'; --- set root password to h5ui

> flush privileges;

> quit

# SET PASSWORD = PASSWORD('h5ui');

 

Kill the mysqld_safe process and restart mysqld.

# kill -9 11283 (11283 is the mysqld_safe process)

# service mysqld start

# mysql -uroot -p (just enter the password h5ui)

 

#################### MySQL 5.7 Create user and authorize ####################

# create user 'cash'@'%' identified by 'h5ui';

# select host,user from mysql.user;

# GRANT ALL ON *.* TO 'cash'@'%';--Grant the cash account operation permissions on all databases

# flush privileges;

 

 

#################### SQL scripts####################

>>> Please execute in order to avoid errors

# source /usr/local/tomcat/sql/pxadmin_drop.sql

 

 

#################### Domain Name####################

# vi /etc/hosts

>xxxx cas.paxsz.com

# reboot (reboot the system to make it take effect)

 

 

#################### Certificate####################

1. Verify that a certificate with the same name has been created

# keytool -list -v -alias pxdesigner -keystore "$JAVA_HOME/jre/lib/security/cacerts" -storepass changeit

2. Delete the created certificate

# keytool -delete -alias pxdesigner -keystore "$JAVA_HOME/jre/lib/security/cacerts" -storepass changeit

3. Generate a certificate in the server

# keytool -genkey -alias pxdesigner -keyalg RSA -keysize 1024 -validity 731 -keystore ~/pxdesigner.keystore -dname "CN=cas.paxsz.com, OU=paxsz, O=paxsz, L=SZ, ST=GD, C=CN" -keypass pax2016 -storepass pax2016

4. View the certificate

# keytool -list -v -keystore ~/pxdesigner.keystore -storepass pax2016

5. Export the certificate, installed by the client

# keytool -export -alias pxdesigner -keystore ~/pxdesigner.keystore -file ~/pxdesigner.cer -storepass pax2016

6. View certificate information

# keytool -printcert -file ~/pxdesigner.cer

7. Client configuration: import the key for the client's JVM (import the certificate issued by the server into the JVM) 

# keytool -import -trustcacerts -alias pxdesigner -keystore "$JAVA_HOME/jre/lib/security/cacerts" -file ~/pxdesigner.cer -storepass changeit

8. Put the certificate and keystore in the specified directory for easy management and tomcat calls

# mv pxdesigner.cer /usr/local/tomcat/keystore/

# mv pxdesigner.keystore /usr/local/tomcat/keystore/

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326613099&siteId=291194637