Preconditions
First of all, we must upload the j2ee development software we need from windows to the opt directory of linux through the xftp5 tool
Note: Here I will use the package name under the figure to operate
Install JDK under Linux
1. Unzip the .gz package of the JDK
2. Configure JAVA_HOME at the last line of the /opt/profile file, then press the esc key, enter: wq Enter, save and exit
3. The source command refreshes the profile file
4. Use the console to enter javac and a prompt appears indicating that the installation is successful
Install mysql under Linux
1. Check whether the mysql installation service already exists under linux
rpm -qa | grep mysql
2. There is an option to uninstall
rpm -e mysql_libs //normal delete mode
rpm -e --nodeps mysql_libs // force delete mode
3. Use the yum command to install the packages needed to compile the code. The yum command requires Linux to be connected to the Internet
yum -y install make gcc-c++ cmake bison-devel ncurses-devel
-- You need to execute some c code later, so you need to install a compilation package that can run c programs
4. Unzip the tar.gz package of mysql under /opt/
tar -zxvf /opt/mysql-5.6.14.tar.gz
5. cd to the mysql directory and execute some preparatory instructions for compilation
cd mysql-5.6.14
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql - DMYSQL_DATADIR=/usr/local/mysql/data -DSYSCONFDIR=/etc - DWITH_MYISAM_STORAGE_ENGINE=1 - DWITH_INNOBASE_STORAGE_ENGINE= - DWITH_MEMORY_STORAGE_ENGINE=1 - DWITH_READLINE=1 - DMYSQL_UNIX_ADDR=/var/lib/mysql/mysql.sock - DMYSQL_TCP_PORT=3306 - DENABLED_LOCAL_INFILE=1 - DWITH_PARTITION_STORAGE_ENGINE=1 -DEXTRA_CHARSETS=all - DDEFAULT_CHARSET=utf8 - DDEFAULT_COLLATION=utf8_general_ci
-- It doesn't matter if you don't understand it, this is what you need to compile some underlying code of c, just copy it
6. Compile and install
make && make install
-- && means to execute the make command first, then execute make install
7. Configure mysql, set mysql permissions
-- mysql is managed by the root user by default, we need to modify mysql to be managed by the mysql user
Check if mysql user and group exist
cat /etc/passwd View user list
cat /etc/group View user group list
Create a mysql group and a mysql user without the mysql user and group, and the mysql user is under the mysql group
groupadd mysql
useradd -g mysql mysql
Modify the file permissions installed in /usr/local/mysql by default, -R recursively modify all file permissions in the mysql directory to the mysql user
chown -R mysql:mysql /usr/local/mysql
8. Enter the /usr/local/mysql directory to initialize the mysql configuration and execute the following commands
cd /usr/local/mysql
scripts/mysql_install_db --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --user=mysql
9. For the installed linux, sometimes there is a configuration file called my.cnf with the same name as mysql in the /etc directory. If it exists, delete or modify its name.
rm -f /etc/my.cnf
10. Add a service, copy the service script to the init.d directory, and set the startup to start [note that it is executed under /usr/local/mysql]
cp support-files/mysql.server /etc/init.d/mysql
chkconfig mysql on -- set the mysql service to start automatically at boot
service mysql start -- start the mysql service
Prompt success indicates that the startup is successful!
11. Configure mysql environment variables
Edit /etc/profile file
Enter the mysql command to log in
12. After mysql is configured, the default password is empty, you need to set a password for it
Enter the mysql command to enter mysql
Set the password to 123456
set password= password('123456');
When you enter exit to log out and then log in, you will find that the login fails and you need to enter the correct password.
Install Tomcat under Linux
1. Unzip the tar.gz package of Tomcat in the /opt directory
tar -zxcf /opt/apache-tomcat-7.0.70.tar.gz
2. Enter the bin directory of tomcat and execute startup.sh to start tomcat
3. Open the Firefox browser under linux and enter localhost:8080 to see if the startup is successful
4. The firewall in linux closes the port for external access by default, so that we cannot access tomcat's port 8080 from other networks, but can only access it locally, so we need to open the firewall to provide external access to port 8080
Modify the /etc/sysconfig/iptables configuration file
Append line 8 to the configuration file, then save and exit:
restart firewall
Access tomcat server under linux through windows browser