Original blog: Doi Technical Team
Link address: https://blog.doiduoyi.com/authors/1584446358138
Original intention: record the learning experience of an excellent Doi technical team
Here is how to build a Java web server on Ubuntu server. Please pay attention to the author’s Ubuntu path changes when entering commands.
1、 Install ssh in Ubuntu server. If you are buying a server, this is already installed, including vim
Get super permissions
Update the installation package first
Start to install ssh
ssh has started
2、 Install Xshell and create a connection
Install Xshell
establish connection
Click ok
3、 Xshell realizes Windows upload/download files to Ubuntu
3.1 upload files
Get super permissions
Install rz/sz tools
Cut to the corresponding directory, enter rz
3.2 download file
Cut into the corresponding folder, enter the sz file name
4、 To install MySQL with root privileges, you need to install the following three
1. apt-get install mysql-server
2. apt-get install mysql-client
3. apt-get install libmysqlclient-dev
The following commands can be used to test login to the mysql database:
mysql -u root -p
-u means user name, -p means user password
5、 Install jdk
Upload files, I put them in /usr/local/
unzip files
Delete original file
Modify folder name
Set variable file
Open /etc/profile with vim
write
JAVA_HOME=/usr/local/jdk
PATH=$JAVA_HOME/bin:$PATH:.
CLASSPATH=$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:.export JAVA_HOME
export PATH
export CLASSPATH
Use vim to write methods, more detailed tutorials on the use of vim, you can Baidu
Insert key to insert; Esc enter the command environment, enter a semicolon [:], enter wq to save and exit
Make it effective
Check whether the jdk is successfully configured
6、 Install tomcat, I put it in /usr/local/
upload files
unzip files
Delete original file
Modify folder name
Set variable file
Open /etc/profile with vim
write
Use vim to write methods
Insert key to insert; Esc enter the command environment, enter a semicolon [:], enter wq to save and exit
Make it effective
Start tomcat
See log
Start successfully
7、 Deploy website
Upload the file, remember to be in the webapps directory under Tomcat
Install the software to decompress the zip
Unzip the file, unzip the compressed package
8、 Set the website file path so that it can have a default path
< Context path="" docBase="/usr/local/tomcat/webapps/fristweb" debug="0" reloadable="true"/>
Close tomcat and then open
9、 Install phpmyadmin. Many friends may not know why I should install phpmyadmin. I want to better operate the MySQL database. After installing phpmyadmin, I can operate the database on the web page, which greatly facilitates our debugging.
Install Apache2
Modify the Apache port, because the default port is 80, which occupies the website port
Just change 8022
Start Apache
Install phpmyadmin
Related
Enter http://localhost:8022/phpmyadmin/ in the browser, you can see our MySQL data, I am a local server, yours should be based on your IP
10、 For other configurations, you will find that Tomcat startup is very slow. The following methods can speed up Tomcat startup
In the tomcat/bin/catalina.sh file, add it at the beginning of the code, you can use vim to write:
export JAVA_HOME="/usr/local/jdk"export JRE_HOME="/usr/local/jdk/jre"export CATALINA_OPTS="-Djava.security.egd=file:/dev/./urandom"
MySQL Chinese garbled problem
Speaking of this, by the way, the MySQL Chinese garbled problem of Ubuntu server
The path of the configuration file in Ubuntu is a bit different, and the content of the configuration file is also different. The following is the path
Write the configuration file with vim and add the following code at the end
[ client]
default_character_set = utf8
[ mysqld]
character-set-server = utf8
collation-server = utf8_general_ci
[ mysql]
default_character_set = utf8
Finally restart MySQL, the command is: /etc/init.d/mysql start
Recommended Posts