Java Photo Station Beauty Installation Tutorial

Java Photo Station Beauty Installation Tutorial

Very good picture site source code, you can use it. Reprinted in full.

1. Introduction to Java Photo Station Source Code Beauty

Java photo site, PC version is exposed at 99mm.me, mobile version is exposed at m.99mm.me

I scraped the pages of these two sites and integrated them into a project to determine whether the visitor's device is a PC or a mobile device on the server backend.

The program does application-level caching:

For example, I publish 3 sets of pictures every day. Within the effective time of the cache (24/3=8 hours), a page only accesses the database once and puts the queried data into memory.

This greatly reduces the pressure on the database and improves the response speed of the server.

When a user accesses a set of images in a browser, they only request the website server once.

When you click to view the next picture in the set, use js to modify the picture link.

No need to request the website server, load the image directly from the image server

This program is tested on a server with 512M memory and can respond very quickly.

Specific test environment: Centos7.5 system with 512M memory + JDK1.7 + Tomcat7 + MySQL5.5

It actually occupies about 300M of memory, and the rest is cached.

The meaning of the database table fields can be found in the comments of domain in the source code. I am too lazy to write it here.

Please refer to the image link in my.properties and change it yourself

Change the database configuration in jdbc.properties according to the situation

There are 3 default categories: sexy, beautiful legs, pure

I wrote the code in the JDK 1.8 environment and used Maven to manage the package.

The database table creation language is placed in the resources folder

Local download : iht-Beauty-20181217

2. Install JDK1.7 + tomcat7 + Mysql5.5.61 environment under centos7.5 64 bit

1. Installation of JDK 1.7

View the installable JDK

1 yum list | grep java

Select the 64-bit 1.7 version java-1.7.0-openjdk.x86_64 here
Installation Commands

1 yum -y install java-1.7.0-openjdk.x86_64

Check whether the installation is successful

1 java -version

If the version information appears, it means the installation is successful.

(II) Installation of Tomcat

Tomcat7 installation command >>> Soha <<<, copy all the following and paste it:

1 2 3 4 5 6 7 8 9 yum install -y wget cd /usr/local wget https: //mc tar .gz /static/archive/fa66329388f85c08e8d6c12ceb8b2ca3/apache-tomcat-7 - .0.77. tar apache apache-tomcat-7.0.77 -zxf apache-tomcat-7.0.77. / .qcloudimg.com mv local -ef | tomcat7 cd /usr/local/tomcat7 /usr/local/tomcat7/bin chmod 777 *.sh . /startup .sh ps tar .gz grep tomcat

Enter the local folder

1 cd /usr/local

Go to the official website to find the download link of Tomcat and download it to the server. Here is a quick download address for Tomcat:

1 //mc wget https: .qcloudimg.com /static/archive/fa66329388f85c08e8d6c12ceb8b2ca3/apache-tomcat-7 .0.77. tar .gz

Unzip this folder:

1 tar tar apache- .gz -zxf apache-tomcat-7.0.77.

Rename this file:

1 mv apache-tomcat-7.0.77 /usr/local/tomcat7

Note: Renaming is for the convenience of subsequent operations. It is not necessary to enter the bin folder.

1 cd /usr/local/tomcat7/bin

Grant permissions to all shell scripts in this folder:

1 chmod 777 *.sh

Start the tomcat service:

1 . /startup .sh

Check whether Tomcat is started successfully

1 ps -ef | grep tomcat

(III) Installation of MySQL 5.5.61

a. Installation preparation

CentOS7 Mariadb database, uninstall first

Method 1: rpm

Find Version

1 rpm -qa| grep mariadb

uninstall

1 rpm -e --nodeps mariadb-libs-5.5.56-2.el7.x86_64

mariadb-libs-5.5.56-2.el7.x86_64 is the version in the current system. You can delete the configuration file according to the actual changes.

1 rm /etc/my .cnf

Method 2: yum
Find

1 yum list installed | grep mariadb

uninstall

1 yum -y remove mariadb-libs.x86_64

Here mariadb-libs.x86_64 is the corresponding version to delete the configuration file

1 rm /etc/my .cnf

b. Detailed installation

1. Download MySQL Community Server 5.5.61 from the official website
Select Operating System: Select Linux Genuric
Select OS Version: Select the corresponding bit number. This time, select 64-bit and click the download button. If you are asked whether to log in, do not log in. Just copy the link below No thanks, just start my download.:
https://dev.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.61-linux-glibc2.12-x86_64.tar.gz
2. Switch to the local folder

1 cd /usr/local

3. Download mysql to the server

1 //dev wget https: .mysql.com /get/Downloads/MySQL-5 .5 /mysql-5 .5.61-linux-glibc2.12-x86_64. tar .gz

4. Unzip

1 tar -xvf mysql-5.5.61-linux .gz -xvf mysql-5.5.61-linux-glibc2.12-x86_64. tar

5.Change the folder name, pay attention to the folder name..

1 mv mysql-5.5.61-linux-glibc2.12-x86_64 mysql-5.5.61

6. Modify the my.cnf configuration file

1 vi /etc/my .cnf

Add the following to my.cnf

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 .sock [mysql] skip-name-resolve # 設置mysql客戶端默認字符集[mysqld] /var/lib/mysql/mysql #設置3306端口default-character- # 設置mysql的安裝目錄, 這里的目錄一定要是你解壓后并且改了名的目錄喲.. =utf8 port=3306 /usr/local/mysql-5 .5.61 set datadir= socket= socket= /var/lib/mysql/mysql .sock /usr/local/mysql-5 /data # 創建新表時將使用的默認存儲引擎-server=utf8 # 設置mysql數據庫的數據的存放目錄, 這里的目錄一定要是你解壓后并且改了名的目錄喲.. max_allowed_packet=16M default-storage-engine=INNODB lower_case_table_name=1 character- # 允許最大連接數basedir= # 服務端使用的字符集默認為8比特編碼的latin1字符集.5.61 max_connections=200 set

7. Switch to the mysql directory

1 cd /usr/local/mysql-5 .5.61

8. Add user groups and users. Here you need to switch the directory to the mysql directory.

1 2 3 groupadd mysql useradd -g mysql mysql chown -R mysql:mysql ./

9. Install MySQL

1 . --user=mysql --basedir= /data/ /usr/local/mysql-5 /usr/local/mysql-5 .5.61/ --datadir= .5.61 /scripts/mysql_install_db

10. Configure Mysql

1 2 3 4 5 6 chown -R mysql:mysql data chown 777 /etc/my .cnf cp . /support-files/mysql .server /etc/rc .d /init .d /mysqld chmod +x /etc/rc .d /init .d /mysqld chkconfig --add mysqld chkconfig --list mysqld

11. Start the service

1 service mysqld start

There may be an error here

1 2 3 Starting MySQL.Logging to '/usr/local/mysql-5.5.61/data/VM_130_189_centos.err' . 180910 18:23:56 mysqld_safe Directory '/var/lib/mysql' for UNIX socket file don't exists. ERROR! The server quit without updating PID file ( /usr/local/mysql-5 .5.61 /data/VM_130_189_centos .pid).

Create the required directories and grant permissions:

1 2 mkdir /var/lib/mysql chmod 777 /var/lib/mysql

12. Configure PATH

1 vi ~/.bash_profile

Add the following content to the end of the file and save it using: wq

1 export PATH=$PATH: /bin .5.61 /usr/local/mysql-5

13. Refresh PATH

1 source ~/.bash_profile

11. Start the service

1 service mysqld start

14. Log in to mysql. There is no password for mysql at this time. When Enter password: appears, press Enter directly

1 mysql -uroot -p

15. Change the root password

1 2 3 use mysql; update user set password=password( '需要設置的密碼' ) where user= 'root' and host= 'localhost' ; flush privileges;

16. Set up remote login

1 GRANT ALL PRIVILEGES ON *.* TO 'root' @ '%' IDENTIFIED BY '剛才設置的root密碼' WITH GRANT OPTION;

Notice:
Note: For Linux MySQL, the default case sensitivity is indicated.

1 2 3 show variables like "%case%" ; vi /etc/my .cnf lower_case_table_names=1

3. Installation of Beauty Photo Station

Import the above database file (beauty.sql) into your database

Then unzip the Beauty.zip package

Go to Beauty–>WEB-INF–>classes, modify the jdbc.properties file, and modify the last 3 lines, which are the address of your database: port/account/password

Then transfer the Beauty folder to the server

Here I created it in the server root directory

 /www/webapps/

folder, and then put the Beauty folder in it

The final path is /www/webapps/Beauty

This will be used when configuring the following

Then enter in ssh

 cd /usr/ local /tomcat7/ conf vi server.xml

Change the line 71 or so below

 < Connector port = "8080" protocol = "HTTP/1.1" connectionTimeout = "20000" redirectPort = "8443" />

Change 8080 in the command to the port you want to configure. The easiest way is to change it to 80. You don't need to add a port to access it.

Then press the arrow key to the end and add a line above the </Host> node. Here is mine:

 < Context docBase = "/www/webapps/Beauty" path = "" />

The value in docBase is the absolute path of the Beauty folder above

Then press Esc + :wq + Enter to save and exit to complete the configuration.

Then restart the Tomcat server.

 cd /usr/ local /tomcat7/bin ./shutdown. sh ./startup. sh

OK, enter your IP or resolved domain name + the port configured above in the browser. If you are accessing through port 80, you don’t need to add the port.

Source code from: https://dev.tencent.com/u/iht/p/Beauty/git
Environment installation comes from: https://coding.ee/109/

<<:  Use Haproxy Keepalived for dual-active load balancing installation and configuration

>>:  VPSDime: $20/month/4GB memory/60GB SSD space/2TB traffic/10Gbps/KVM/Dallas

Recommend

Virtualmin/Webmin installation package released by ctohome

Although the Virtualmin/Webmin panel is relativel...

GalaxyHostPlus: $15/month/9GB memory/1TB space/unlimited traffic/2 IP/KVM/France

GalaxyHostPlus, an Irish hosting provider, was es...

Cloudcone: Los Angeles KVM VPS, 256MB RAM, 1TB bandwidth, $13.93/year

CloudCone is a relatively active hosting provider...

123systems: $4.5/year/256MB/10GB space/500GB traffic/OpenVZ/Los Angeles

The temptation of 123systems is here again, this ...