Summary of JDK, Tomcat and MySQL Building Method under CentOS 6.8

Keywords: MySQL Tomcat yum RPM

Because of the need of work and study, we need to build various development environments on centOS server. Because there are many methods on the internet, I will summarize them here.

JDK

Because downloading JDK on a computer requires clicking on "accept licence" to download, the following conditions need to be added to the wget method

--no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie"

For example, the latest JDK version is 8u121, so enter:

wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u121-b13/e9e7ea248e2c4826b92b3f075a80e441/jdk-8u121-linux-x64.rpm

The default download path is / root. To move the installation package, use the mv operation (which can be moved and renamed at the same time).
Finally, use the rpm installer:

rpm -ivh package_name.rpm

Meaning of rpm parameters:
i: specify that the package is installed as a required parameter
v: Output installation details
h: Display hashes as installation progress bar during installation
rpm installation automatically configures environment variables, so you don't need to add environment variables to / etc/profile files

Tomcat

Find the required tomcat version on the official website, and use tomcat 7.0 as a demonstration below.

First find the tar.gz package you need to download

http://mirrors.tuna.tsinghua.edu.cn/apache/tomcat/tomcat-7/v7.0.75/bin/apache-tomcat-7.0.75.tar.gz

Use tar to decompress when wget is downloaded locally

tar -zxvf apache-tomcat-7.0.75.tar.gz

Here again, the meaning of several parameters is explained:
z: Whether it has gzip attribute or not, if it is tar package, it can not be filled in
x: decompression
v: Display files during compression and decompression
f: Use filename, and f must be followed directly by filename

After decompression, the folder is renamed tomcat7 for easy viewing.

mv apache-tomcat-7.0.75 tomcat7

Start the service, try it, a relative path, an absolute path

./tomcat7/bin/startup.sh
/root/tomcat7/bin/startup.sh

Write the startup script to / etc/rc.d/rc.local:

touch /var/lock/subsys/local
/root/tomcat7/bin/startup.sh

Set tomcat username and password:

vi /root/tomcat7/conf/tomcat-users.xml
//stay<tomcat-users>Last addition
<role rolename="admin-gui"/>   
<role rolename="manager-gui"/>
<user username="tomcat" password="tomcat" roles="manager-gui,admin-gui"/>

If you use the user settings information annotated in the file, 403 errors will be reported, because there is no specified user's permission to access Manager App pages requires manager-gui permission, and access to Host Manager requires admin-gui permission.

MySQL

Go to the official website and identify Yum Repository, which is the source of MySQL's Yum installation. After downloading the corresponding linux version, install it with the yum command

yum install mysql57-community-release-el6-9.noarch.rpm

Then you can use yum list | grep mysql to display all the MySQL information on yum to see if the new version of the source has been added. 6.8 yum comes with version 5.1, centOS 7.0 seems to have no normal version of mysql, you need to install the source under the official network.

Start installing mysql after confirming that the source has been added

yum install mysql-community-server

Start the service after installation

service mysqld start

The first installation of mysql generates a temporary password that can be used to login to mysql before the administrator password can be modified.
Check the temporary password:

grep "password" /var/log/mysqld.log
2017-03-12T09:49:13.417267Z 1 [Note] A temporary password is generated for root@localhost: sbiM)c+li8qF

Log in mysql as root user:

mysql -u root -p

You will be prompted to enter the password, copy the temporary password and paste it on.

Change Password:

mysql>SET PASSWORD FOR 'root'@'localhost' = PASSWORD('newpassword');

Because mysql is encoded in Latin by default, you also need to modify the character set to uft8

vi /etc/my.cnf
 Press i or insert to enter the insert mode and add:
character-set-server=utf8
 Add the [client] section at the end of the file, and then add the following: ____________
default-character-set=utf8
 Exit editing mode, enter: wq save

Restart service:

service mysqld restart

See if the character has been modified:

mysql>show variables like "%character%";

Open mysql remote access rights:

mysql>GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'youpassword' WITH GRANT OPTION;

In fact, it assigns all permissions to root users who log in using any IP

Overload Authorization Form:

mysql>FLUSH PRIVILEGES;

Exit mysql:

exit; or quit;

Above is the method summarized at present, if there are any problems to be added later.

Posted by westonlea7 on Sat, 20 Apr 2019 18:30:33 -0700