Deploy the website developed by JSP to the Linux Environmental Guide
1. Overview website deployment process overview. The Deployment Guide is about how to deploy a primary website on a server, as well as related hardware and software configurations, and related terms. 2. Hardware and software environment 2.1 master configuration: Hardware configuration: memory 1024MB, hard disk SCSI 36GX2, CPU dual to strong 2.0, dual Gigabit card configuration: Linux7.2, jdk1.4.2, resin-2.1. 12, mysql4.0.18, iglooftp pro3.9, t98setup telnet, Yangchun Snow (Chinese Editing Software), etc. 3. Installation Procedure 3.1 Linux 7.23.1.1 CD Start Starting the first Linux7.2 disc in the optical drive, and the welcome screen of Red Hat Linux 7.2 will appear after startup. Press the ENTER button directly in the above screen. After a period of startup process, you can see the installation welcome screen of the Red Hat Linux graphics mode.
Select Language: Chinese (Simplified) Keyboard: Generic 105-Key (int) PC: US ENGLISH: Using dead key mouse: Generic 2Button Mouse (PS / 2) Installation Level: Server Installing the Graphics Distance: (CTX-EX700, 24 True Color, 800 x 600) Hard disk partition 1. Let the installer automatically split the hard drive: a. This will first delete the hard disk partition on the hard disk before you have previously installed it. b. Delete all partitions and resolve the hard drive. If there is already other operating systems on the hard disk will delete the original partition. c. Save existing partitions and use the unused partitions to split your hard drive. 2. Manual partitioning, you can use the fdisk tool to complete the settings according to actual needs. Time Zone Selection: Click the left mouse button at Shanghai, China. Firewall (default): Level is intermediate. Setting the network environment: NIC installed TCP / IP settings: IP Address: 192.168.12.40Netmask: 255.255.255.0Network: 192.168.0.0Broadcast: 192.168.0.255Hostname: bjhlyGateway: 192.168.12.1Primary DNS: 192.168.0.255Secondary DNS: Ternary DNS:
/ DEV / I2O /
3.1.2 Installing Yangchun Snow Double-click Ycbx-Setup on the Yangchun Snow CD After you can install it, you can use the Chinese input after installation. 3.2 JDK1.4.2 3.2.1 Installing J2SDK-1_4_2_04-Linux-i586.rpm First copy J2SDK-1_2_04-Linux-I586.rpm to / usr / local directory, then execute rpm -ivh j2sdk-1_4_2_04-linux- I586.RPM J2SDK-1_4_2_04 is installed in the / usr / java directory. 3.3 resin2.1.123.3.1 Installing RESIN-2.1.12.tar.gz first copies the resin-2.1.12.tar.gz to / usr / local directory, then execute tar -xzvf resin-2.1.12.tar .gz resin-2.1.12. It is installed in the / usr / java directory. 3.3.1 Modify Environment Variables Modify / etc Directory Path = "$ PATH: /USR/JAVA/J2SDK1.4.2_04/j2sdk1.4.2_04/j2sdk1.4.2_04/bin" java_home = /usr/java/j2sdk1.4.2_04export Java_HOMEJRE_HOME = / usr / java / j2sdk1.4.2_04 / jreexport JRE_HOMECLASSPATH = / usr / java / j2sdk1.4.2_04 / lib: /usr/java/j2sdk1.4.2_04/jre/libexport CLASSPATH If there is an environmental variable that cannot be found in the classpath: copy the / usr / local / j2sdk-1_4_2_04 / lib directory to /usr/java/resin-2.1.12/lib's directory. 3.3.1 Resin Starts and Stop [Root @ bjhly root] CD /USR/JAVA/RESIN-2.1.12/bin [root @ bjhly bin] ./httpd.sh -start opens resin [root @ BJHLY BIN] ./ttpd.sh -stop stop Resin
3.4 mysql 4.0.18 3.4.1 Install MySQL:
Mysql-server-4.0.18-0.i386.rpm mysql-client-4.0.18-0.i386.rpm download address is: http://www.mysql.com/downloads/mysql-4.0.html, found Server "and" Client Programs "items, download two RPM files required. The RPM file is the software installation package developed by Red Hat. RPM allows Linux to exempt a lot of complex procedures when installing the package. This command is installing the parameters that are -IVH, where i indicates that the specified RMP package, V represents the details of the installation, H indicates that "#" symbols during the installation show the current installation process. This symbol will continue until the installation is complete.
1) Install the server side
2) Run the following command in the directory of two RMP files:
[root @ Test1 local] # rpm -ivh mysql-server-4.0.18-0.i386.rpm
3) Show the following information. Warning: mysql-server-4.0.18-0.i386.rpm: v3 DSA Signature: Nokey, key id5072e1f5preparing ... ####################################################################################################################################################################################################################################################### ############# [100%] 1: mysql-server ############## ######################################### . . . . . (Omitted) / usr / bin / mysqladmin -u root password 'new-password' / usr / bin / mysqladmin -u root -h test1 password 'new-password'. . . . . . (Omitted)
Starting MySQLD daemon with databases from / var / lib / mysql As mentioned, the server is installed. The test is successful to run NetStat to see if the mysql port is open, if the service has been started, the installation is successful. MySQL default port is 3306. [root @ bjhly local] # netstat -natactive internet connections (Servers and Established) Proto Recv-q Send-Q local address Foreign Address State TCP 0 0 0.0.0.0:3306 0.0.0.0.0:0:0:3306 0.0.0.0:0:0:3306 It has been started.
2) Install the client
Run as follows: [Root @ bjhly local] # rpm -ivh mysql-client-4.0.18-0.i386.0.18-0.i386.rpm: v3 DSA Signature: Nokey, Key ID 5072e1f5preparing ... ############################# [100% ] 1: mysql-client ################################################ 100%] The display is complete. 3. 4. Log in to MySQL
The command to log in to mysql is mysql, MySQL's usage syntax is as follows: mysql [-u username] [-h host] [-p [password]] [dbname] UserName and Password are MySQL username and password, MySQL initial management The account is root, no password, note: this root user is not a Linux system user. MySQL default user is root, because there is no password in the initial, just type mysql for the first time. [root @ bjhly local] # mysql welcome to the mysql monitor. commands end with; or /g.Your mysql connection ID is 1 to server version: 4.0.16-standardtype 'help;' or '/ h' for help. Type '/ c' to clear the buffer.mysql> "MySQL>" prompt, congratulations, successful installation! The login format after the password is added as follows: mysql -u root -p enter password: (Input Password) where -U follows the username, -P requires the password, enter the password at the input password after entering the password. 3.4.3 Increase MySQL users
Format: Grant SELECT ON Database. * To User Name @ Login Host Identified By "Password" Example 1, add a user user_1 password 123, let him log in on any host, and have queries, insert, modify, Delete permissions. First, use the root user into MySQL, then type the following command:
MySQL> Grant SELECT, INSERT, UPDATE, DELETE ON *. * TO ZSX @ "%" Identified by "123"; Example 1 Increased users are very dangerous, if you know the user_1 password, then he can be online Sign in to your MySQL database on any computer and see you for your data.
Example 2, add a user user_2 password 123, allowing this user to log in in localhost, and can query, insert, modify, and delete database AAA (localhost refers to the host host, the host of the mysql database). This way, this user does not use the password knows User_2, he cannot directly access the database from the Internet, and can only operate the AAA library through the MySQL host.
Mysql> Grant SELECT, INSERT, UPDATE, DELETE ON TEST. * To Zsx @ localhost identified by "123";
If you can't log in with new users, use the following command when logging in:
MySQL -U User_1 -P -H 192.168.113.50 (He is following the IP address to log in to the host) 3. 4. 4 Start and stop 1. Start the mysql installation After start the file mysql in the /etc/init.d directory Under, you can run the following command when you need to start. [Root @ bjhly init.d] # /etc/init.d/mysql Start Stop / usr / bin / mysqladmin -u root -p Shutdown 3. 4. 5 Add mysql users
Add a user username password 123, allowing this user to log in in localhost, and you can query, insert, modify, and delete the database Test (localhost refers to the host host, the host where the MySQL database is located), The user even if you know the username password, he cannot access the database directly from the Internet, and can only operate the Test Library through the MySQL host. Mysql> Grant SELECT, INSERT, UPDATE, DELETE, CREATE ON TEST. * To username @ localhost identified by "123"; 3.4.6 Backup and Recovery
1, backup
For example, back up database Test in a Linux environment Go to Windows, you can connect to Linux's MySQL database through the mysql under Windows, and then export the database as the script back_test.sql.
2. Restore, for example, the database script back_test.sql backup in the Windows environment is restored to Linux, and you can also connect to Linux's MySQL database, restore the database. 3.5 Website Deployment 3.5.1 The JSP developed under Windows will be uploaded to the corresponding directory in the Linux RESIN through the FTP tool. Copy the files in the DOC and WebApps directory to the corresponding directory of /usr/java/resin-2.1.12 in Linux. 3.6 FTP 3.6.1 File Transfer Protocol Principles Internet Document Transfer Protocol (FTP) standard is illustrated in RFC959. This protocol defines a standard for transferring files from remote computer systems and local computer systems. In general, the user who transports files needs to log in to the website after authentication, and then access the files in the remote server. Most FTP servers often provide a Guest public account to allow users with no remote servers to access the FTP server. 3.6.2 The software used is IGLOOFTP Pro3.9. IGLOOFTP Pro can be said to be one of the best FTP client software in Linux. Its interface is described in "gorgeous" to describe it, his biggest feature is easy to use, powerful, can adjust many set options. Many selection items can be selected to complete the relevant icons; there is a fast toolbar, fast link, and the graphical directory of the local area browse the window, beautiful file-related icon, and Netscape's gadget column. The server address book, uses a tree-like website method, and each FTP Site and Group information can be easily adjusted. There is also a user profile management; the far-end controls a FTP Server to FTP Client Transmission Data (FXP TransferS); monitoring in the URL scrapbook; firewall support (including SOCKS 5, FTP-GW, Wingate Proxy, etc.); the quick-end directory of the remote directory; queue management; there are many advanced user commands, and more. 3.6.3 WU-FTP Installing WU-FTP Depending on the service object, the FTP service can be divided into two categories: one is a system FTP server, which only allows legitimate users on the system; the other is anonymous FTP Server, which allows anyone to log in to the FTP server, and enters anonymous in the login prompt after connecting to the server. For these two services, the WU-FTPD RPM package can be installed through the first CD of Redhat, just enter the system as root, you can run the following command: rpm - ivh anonftp -xx-x.i386.rpm rpm - IVH wu-ftpd-xxx-x.i386.rpm where -xx-x and -xxx-x are version numbers. 3.6.4 Starting and closing the FTP server is automatically started, but when we change the WU-ftpd configuration file, you need to use manual boot: Start: / usr / sbin / ftprestart off: / usr / sbin / ftpshut3. 6.5 Configuration of FTP Server The FTP server is a very common service function, so Linux will install the FTP server in the default state.
Before logging in to the FTP server, you must first check the contents of the /etc/xinetd.d/wu-ftpd, open this file with the text editor. (Change Disable = YES to "NO") To ensure that the FTP server is secure, some important configuration files must be set to better control the user's access. These profiles are: / etc / ftpusers, / etc / ftpConversions, / etc / ftp-groups, / etc / ftpppHosts, / etc / ftpaccess. Using these files, which people can control very accurately, what time, where to connect the server, and you can check the work after they are connected. / Etc / ftpusers: The user contained in this folder cannot log in to the server through the FTP, sometimes the user account is written to the file / etc / ftpuser, so that some users can prohibit the use of FTP services. / Etc / ftpconversions: Used to configure compression / decompression programs. / Etc / ftpgroups: Create a user group, and members in this group predefine can access the FTP server. / etc / ftpphosts: Used to access or allow remote hosts to specific accounts, for example: Allow ZLC 192.168.12.33 Deny ZLC 192.168.12.34 means that ZSX users are allowed from 192.168.12.33 IP connection, reject ZLC from 192.168. 12.34. This IP connection is accessible. / etc / ftpaccess: is a very important configuration file to control access rights, each row in the file define an attribute and set the value of the attribute. Here is some of its common configurations to introduce: 1. Define user category format: Class [Class Name] [REAL / GUEST / Anonymous] [IP Address] function: The function of this instruction sets the category of the user on the FTP server. And the client's IP address can be restricted, allowing specific or all IP addresses to access the FTP server.
2, the login retries are entered in the command line: loginfails 10, which indicates that the connection is cut if it is not logged in 10 times. 3, password check format: Passwd-check
It is an inspection of the password usage of anonymous users, where stricTness> is one of three possible strings: None, Trivial, RFC822. If NONE is selected, it means that it will not be checked for passwords; if TriVial, it means that there is a certain requirement for the password, it needs to have at least one @ symbol in the password; if RFC822, the most stringent, require E-mail address The RFC822 message title must be observed (eg zlc@domain.com). For example: Passwd-Check RFC822 Warn, indicating that the password is very strict, and when the password does not meet the regulations, warning information will occur. 4. Restriction format of the number of logins: limit [Category] [Number] [Time] [File Name] Settings The specified category can log in to FTP in the agreed time. For example: Limit Remote Any / etc / MANY.MSG, indicating that the Category Remote category does not more than 20 people in any time, otherwise the MANY.MSG warning message will be displayed. Use these configurations reasonably to effectively protect our server. Verify, installation, after configuring the FTP server, you can verify that the FTP server can be accessed with graphics tools and command lines. The most common command in Linux is FTP, which provides an uncomplex FTP server interface. Connect to the FTP server, just enter: ftp servername after the command prompt, use the hostname or want to connect the IP address of the FTP server instead of ServerName, follow the prompts to enter the username and password, then move or move off or down with the standard Linux. Server directory structure. In addition, graphical FTP programs can also be used, including window GFTP, which can access the FTP server with a web browser. The above is the point of the FTP server configuration under Linux, and there is a good graphics tool in Linux7.2 / KDE menu / system / ftpd editor. This visual editor can also complete the above functions. 3.7 Telnet remote management 3.7.1 Remote login principle Using the Telnet command to log in to the remote computer via the network, just like the local computer operation. But the user must know the URL or IP address of the remote computer, as well as the account and password. 3.7.2 Installing the Telnet tool Double-click the installer T98Setup.exe, Telnet is a graphics application, which allows the user to log in to a remote computer remotely and publish a command. The protocol used by this Telnet is SSH-3DES.
3.7.3 Launch Telnet Service
Since the Red Hat Linux 7.1 half, the Telnet service is not enabled by default, so anyone must not log in to this machine. In order to start this service, open the /etc/xinetd.d/telnet profile with a text editor and do the following modifications:
#default: ON
...
Service telnet {
If DISABLE = YES will change "YES" to NO.
...
} After saving the file, execute the /etc/init.d/xinetd Reload command to reload the configuration file, will immediately enable Telnet service. However, for security considerations, the Linux system does not allow remote login to ROOT account by default!