First, mount the data disk
1. View Data disk
Before partitioning and formatting the data disk, using the "df–h" command, you cannot see the data disk, you can use the "fdisk-l" command to view.
2. Partition the data disk
Execute the "fdisk/dev/xvdb" command to partition the data disk;
According to the prompt, enter "n", "P" "1", two times Enter, "Wq", the partition will begin, will be completed soon.
3. View New partitions
With the "fdisk-l" command you can see that the new partition XVDB1 has been established.
4. Format the new partition
The new partition is formatted with the MKFS.EXT3/DEV/XVDB1 command, and the time to format varies depending on the size of the hard disk.
5. Add partition information
Write the new partition information using the "Echo '/dev/xvdb1/mnt ext3 defaults 0 0 ' >>/etc/fstab" command.
Then use the "cat/etc/fstab" command to view the information.
6. Mount the new partition
Use the "mount-a" command to mount the new partition, and then use the "df-h" command to see if it was successful.
At this point, the data disk is mounted successfully, as/MNT exists.
Second, delete the unwanted package
Yum Remove deployment_guide-en-us finger cups-libs cups bluez-libs desktop-file-utils PPP Rp-pppoe wireless-tools irda-ut Ils nfs-utils nfs-utils-lib rdate fetchmail eject ksh mkbootdisk mtools syslinux tcsh startup-notification talk APMD RMT d UMP setserial Portmap yp-tools Ypbind
Third, remove the less secure package:
Yum remove Telnet rsh ftp rcp
Iv. Configuring Firewalls
1. Clear the existing iptables rules:
Iptables-f
Iptables-x
Iptables-z
2, open the designated port:
(You need to leave your modified SSH login port in the firewall: Modify the 4th line, change the 22 to your replacement port)
Iptables-a input-s 127.0.0.1-d 127.0.0.1-j ACCEPT
Iptables-a input-m State--state established,related-j ACCEPT
Iptables-a output-j ACCEPT
Iptables-a input-p TCP--dport 22-j ACCEPT
Iptables-a input-p TCP--dport 80-j ACCEPT
Iptables-a input-p TCP--dport 21-j ACCEPT
Iptables-a input-p TCP--dport 20-j ACCEPT
Iptables-a input-j REJECT
Iptables-a forward-j REJECT
3. Save Firewall Rules
Service Iptables Save
Five, install LNMP
1, install screen
Yum install screen
Run: screen-s lnmp
2, download LNMP One-click installation package:
wget-c http:// Soft.vpser.net/lnmp/lnmp0.9-full.tar.gz
3, decompression LNMP One-click installation package:
Tar zxvf lnmp0.9-full.tar.gz
4, Start install LNMP One-click installation package:
Execute CD lnmp0.9-full/
./centos.sh 2>&1 | Tee lnmp.log
Enter the domain name you want to bind ( Recommended to use a two-level domain name (such as: web.123.com), the domain name will be bound to/home/wwwroot/, easy to manage later, do not use their own primary domain! If the input has an error, you can press and hold CTRL and then press BACKSPACE key to delete, enter the completion of the return
and enter the password to set the MySQL root, enter the completion of the return
if you need to install InnoDB, you can enter the Y return, do not need to directly enter.
Prompt "Press any key to start ..." To start the installation by pressing ENTER. the
Lnmp script automatically installs software that compiles nginx, MySQL, PHP, PhpMyAdmin, Zend Optimizer.
VI, Virtual Host Management
1, add a virtual host, execute the following command:/root/vhost.sh According to the prompts to enter the domain name to bind, enter, if you need to add more domain names, input y, and then enter the domain name to be additional binding, multiple domain names can be separated by a space ( Note: with www and without www is a different domain name, such as the need to take the WWW and without the WWW domain name All access to the same website need to be bound at the same time). Then enter the domain name binding directory (absolute directory, such as/HOME/WWWROOT/LNMP, if not fill the default is the/home/wwwroot/bound domain name, the directory is not necessarily/home/wwwroot/, if there is a lot of space below the/data/can be filled out/ Data/www/lnmp or something like that. ), and then choose whether to add pseudo-static rules, the default already has Discuz, DISCUZX, WordPress, Sablog, Emlog, Dabr, Phpwind, WP2 (two-level directory WP pseudo-static), you can directly enter the above name, If you need to add a custom pseudo-static rule, directly enter a desired name, the program will automatically create a pseudo-static file, directly in the/usr/local/nginx/conf/you customize the pseudo-static name. conf add pseudo-static rules on the line (note: Add execution/ETC/INIT.D /nginx restart restart in effect). Next will be prompted whether to enable the logging function, generally do not need to start, directly enter N on the line, if you want to start, enter Y, and then enter the name of the log file to be defined, enter will automatically add the virtual host.
2, delete the virtual host, ssh execution: rm/usr/local/nginx/conf/vhost/domain name. conf
Vii. modifying the website and MySQL directory
Web site Directory changes only need to modify the corresponding virtual host configuration file, the root of the directory into a new directory, and then execute: cp-a old directory new directory, chown www:www-r new directory.
MySQL directory changes, first need to stop the MySQL server/etc/init.d/mysql stop, the new directory to/mnt/mysql/for example, and then Cp-r/usr/local/mysql/var/*/mnt/mysql/, Again chown mysql:mysql-r/mnt/mysql/below modify/etc/my.cnf, find [mysqld], add datadir =/mnt/mysql/save, start MySQL.
Viii. Installation of other components
(Note: Install the following components, must be in the lnmp0.9 installation directory, that is, the LNMP compressed package after the CD lnmp0.9/after the directory!, if you cannot find the Find/-name eaccelerator.sh. )
(Note: The following components are not necessarily required, please use according to your needs!)
1, install the PUREFTPD and FTP management panel, execute the following command:./pureftpd.sh follow the prompts to enter your MySQL root password, FTP user management panel password, MySQL FTP database password (can directly enter, automatically generate a password), enter the confirmation, will automatically install PUREFTPD, prompted after the installation of PUREFTPD, in the browser to execute http://your domain name or ip/ftp/Enter the password you set in front of the FTP user management panel, you can manage FTP.
2, install Eaccelerator, execute the following command:./eaccelerator.sh, follow the prompts to select the version, enter the confirmation, will automatically install and restart the Web service.
3, install Ioncube, execute the following command:./ioncube.sh when you confirm, the Web service is installed and restarted automatically.
4, install ImageMagick, execute the following command:./imagemagick.sh when you confirm, the Web service is installed and restarted automatically.
5, install memcached, execute the following command:./memcached.sh when you confirm, the Web service is installed and restarted automatically.
6, upgrade the Nginx version, execute the following command:./upgrade_nginx.sh Enter the version number of Nginx as prompted, such as 1.0.10, and the version number can be obtained from http://nginx.org/en/download.html. (Note: MySQL, PHP-FPM will be paused during the upgrade.) )
7, upgrade the PHP version, execute the following command:./upgrade_php.sh Enter the PHP version number, such as 5.3.6, as prompted. (Note: Some website programs, such as SHOPEX, have compatibility issues, make sure you use the program to support the 5.3.* version before upgrading.) Nginx, MySQL, and PHP-FPM will be paused during the upgrade process. )
Linux System One-click Deployment Lnmp