CentOS-7-1511+JDK8+Tomcat7+MySql5.6

make dir [kao] in home/ , then copy files to home/kao


//--------------------------------------------------------------------------- jdk1.8 start
1. make jdk dirs
cd ..
sudo mkdir kao
cd kao
sudo mkdir swsetup
sudo mkdir webs
cd swsetup
sudo mkdir java
cd java
sudo tar -zxvf /home/kao/sw/jdk/jdk-8u201-linux-x64.tar.gz
sudo mv jdk1.8.0_201 jdk8
cd jdk8

then:  the path is /usr/kao/swsetup/java/jdk8

2. java path
echo $JAVA_HOME
echo $JRE_HOME
echo $CLASSPATH
echo $PATH

gedit ~/.bashrc

export JAVA_HOME=/usr/kao/swsetup/java/jdk8
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:${PATH}

then:  save file, and input command:  source ~/.bashrc
//-------------------------------------------------------------------------- jdk1.8 end



//-------------------------------------------------------------------------- tomcat 7 start
1. make tomcat dirs
cd /usr/kao/swsetup
sudo mkdir server
cd server
sudo mkdir tomcat
sudo tar -zxvf /home/kao/sw/tomcat/apache-tomcat-7.0.93.tar.gz -C /usr/kao/swsetup/server/tomcat
sudo mv apache-tomcat-7.0.93 tomcat7
cd tomcat7
pwd

the path is : /usr/kao/swsetup/server/tomcat/tomcat7

2. tomcat startup and shutdown
cd /usr/kao/swsetup/server/tomcat/tomcat7/bin
sudo ./startup.sh
sudo ./shutdown.sh


then : open browser and input http://localhost:8080


3. config tomcat server.xml
cd /usr/kao/swsetup/server/tomcat/tomcat7/conf
sudo cp -r ./server.xml ./server_bk.xml
sudo gedit ./server.xml


then : update the , change the port, save xml file, and restart the tomcat server

4. tomcat add to service
1) edit catalina.sh
cd /usr/kao/swsetup/server/tomcat/tomcat7/bin
sudo cp /usr/kao/swsetup/server/tomcat/tomcat7/bin/catalina.sh /usr/kao/swsetup/server/tomcat/tomcat7/bin/catalina.sh.backup
sudo gedit /usr/kao/swsetup/server/tomcat/tomcat7/bin/catalina.sh

add java path and catalina path:
JAVA_HOME=/usr/kao/swsetup/java/jdk8
CATALINA_HOME=/usr/kao/swsetup/server/tomcat/tomcat7

then : save file and exe copy files
sudo cp /usr/kao/swsetup/server/tomcat/tomcat7/bin/catalina.sh /etc/init.d/tomcat
sudo service tomcat start|stop|run

//---------------------------------------------------------------------------- tomcat 7 end




//----------------------------------------------------------------------- mysql5.6 start
is 5.6, is 5.6 is 5.6 _ _|||....

1. delete mysql
sudo find / -name mysql
//-----------------------------------------
/var/lib/mysql
/usr/lib64/mysql
/usr/share/mysql
/usr/kao/swsetup/db/mysql
/usr/kao/swsetup/db/mysql/mysql5.6/include/mysql
/usr/kao/swsetup/db/mysql/mysql5.6/data/mysql
/usr/kao/swsetup/db/mysql/mysql5.6/bin/mysql
//-----------------------------------------

sudo rm -rf /usr/kao/swsetup/db/mysql/mysql5.6/
sudo rm -rf /var/lib/mysql
sudo rm -rf /usr/lib64/mysql
sudo rm -rf /usr/share/mysql

2. delete /etc/my.cnf
sudo rm -rf /etc/my.cnf

3. delete /etc/init.d/mysql
sudo rm -rf /etc/init.d/mysql
sudo rm -rf /etc/init.d/mysqlId

4. delete group and user
sudo userdel mysql

5. make mysql dirs
cd /usr/kao/swsetup
sudo mkdir db
cd db
sudo mkdir mysql
cd mysql
sudo tar -zxvf /home/kao/sw/mysql/mysql-5.6.43-linux-glibc2.12-x86_64.tar.gz -C /usr/kao/swsetup/db/mysql
sudo mv mysql-5.6.43-linux-glibc2.12-x86_64 mysql5.6
cd mysql5.6
pwd

then : the path is /usr/kao/swsetup/db/mysql/mysql5.6

6 add group and user
sudo yum install perl
sudo yum install 'perl(Data::Dumper)'

groups mysql
sudo groupadd mysql
sudo useradd -r -g mysql mysql

7. check [libaio]
rpm -qa | grep libaio
yum search libaio

8. conf my.cnf
sudo touch /etc/my.cnf
sudo gedit /etc/my.cnf
then, copy info into my.cnf:

[mysql]
# 设置mysql客户端默认字符集  
default-character-set=utf8
socket=/tmp/mysql.sock
[mysqld]
#skip-name-resolve
#设置3306端口
port=3306
socket=/tmp/mysql.sock
# 设置mysql的安装目录
basedir=/usr/kao/swsetup/db/mysql/mysql5.6 
# 设置mysql数据库的存放目录
datadir=/usr/kao/swsetup/db/mysql/mysql5.6/data
# 允许最大连接数
max_connections=200
#服务器端默认字符编码
character-set-server=utf8
# 创建新表的时候默认的存储引擎
default-storage-engine=INNODB
#lower_case_table_name=1
max_allowed_packet=100M


9. change 
sudo chown -R mysql:mysql /usr/kao/swsetup/db/mysql/mysql5.6
or->
cd /usr/kao/swsetup/db/mysql/mysql5.6
sudo chown -R mysql:mysql ./

10. init mysql and password
cd /usr/kao/swsetup/db/mysql/mysql5.6
sudo ./scripts/mysql_install_db --user=mysql
sudo ./support-files/mysql.server start
sudo ./bin/mysqladmin -u root -h localhost.localdomain password 'K123456'
sudo ./bin/mysql -h 127.0.0.1 -u root -p

password:
mysql > update mysql.user set password=password('K123456') where user='root'; 
mysql > flush privileges;
host %:
mysql > grant all privileges on *.* to root@'%' identified by 'K123456'; 
mysql > flush privileges;
mysql > use mysql;
mysql > select host, user from user;
mysql > update user set host = '%' where user ='root';
mysql > select host, user from user;
mysql > flush privileges;

12. add service
cd /usr/kao/swsetup/db/mysql/mysql5.6
sudo cp support-files/mysql.server /etc/init.d/mysqld 
sudo chkconfig --add mysqld 
sudo chkconfig mysqld on 
sudo service mysqld restart  
sudo service mysqld status

13. others
1) kill mysqld
ps -ef|grep mysqld
kill -9 [process id]

2) linux open 3306

//-------------------------------------------------------------------- mysql5.6 end



































 

你可能感兴趣的:(DataBase)