Lamp website deployment

Source: Internet
Author: User

Lamp website deployment

The standby website should be deployed on the Vsphere client at the company's request for backup. Do not ask why virtualization is willful.

Environment centos6.5 directly uses yum to install the environment. When the new machine is started, a script written by a colleague from the company:

#!/bin/bash# Program:# system_init_shell# History:# Release:# 1.1cat << EOF+--------------------------------------------------------------+| === Welcome toCentOS6.x System init === |+--------------------------------------------------------------++---------------------------by opsren--------------------------+EOF#update system packyum -y install gcc gcc-c++ make autoconf libtool-ltdl-devel gd-devel freetype-devel libxml2-devel libjpeg-devel libpng-devel openssl-devel curl-devel bison patch unzip libmcrypt-devel libmhash-devel ncurses-devel sudo bzip2 mlocate flex lrzsz sysstat lsof setuptool system-config-network-tui system-config-firewall-tui ntp libaio-devel wget ntp iotop tcpdump openssh-clients vim telnet curl logwatch net-snmpyum update -y#set clockcp -f /usr/share/zoneinfo/Asia/Shanghai /etc/localtime#set ntpcp -f /etc/ntp.conf /etc/ntp.baksed -i '10s/^.*$/restrict default ignore/' /etc/ntp.confservice ntpd restartchkconfig --level 234 ntpd on#set ulimitecho "ulimit -SHn 102400" >> /etc/rc.localcat > /etc/security/limits.conf << EOF* hard nofile 65536* soft nofile 4089* hard nproc 16384* soft nproc 10240* hard rss 100000EOF#set max user processessed -i 's/1024/102400/' /etc/security/limits.d/90-nproc.conf# turnoff the control-alt-deletesed -i 's#exec /sbin/shutdown -r now#\#exec /sbin/shutdown -r now#' /etc/init/control-alt-delete.conf#set LANG:> /etc/sysconfig/i18ncat >> /etc/sysconfig/i18n << EOFLANG="en_US.UTF-8"EOF#set sshsed -i 's/^GSSAPIAuthentication yes$/GSSAPIAuthentication no/' /etc/ssh/sshd_configsed -i 's/#UseDNS yes/UseDNS no/' /etc/ssh/sshd_config#sed -i 's/#Port 22/Port 6343/' /etc/ssh/sshd_configservice sshd restart#set sysctltrue > /etc/sysctl.confcat >> /etc/sysctl.conf << EOFfs.aio-max-nr = 1048576fs.file-max = 6815744net.ipv4.ip_forward = 0net.ipv4.conf.default.rp_filter = 1net.ipv4.conf.default.accept_source_route = 0kernel.sysrq = 0kernel.core_uses_pid = 1net.ipv4.tcp_syncookies = 1kernel.msgmnb = 65536kernel.msgmax = 65536kernel.shmmax = 68719476736kernel.shmall = 4294967296kernel.shmmni = 4096kernel.sem = 250 32000 100 128net.ipv4.tcp_max_tw_buckets = 6000net.ipv4.tcp_sack = 1net.ipv4.tcp_window_scaling = 1net.ipv4.tcp_rmem = 4096 87380 4194304net.ipv4.tcp_wmem = 4096 16384 4194304net.core.wmem_default = 262144net.core.rmem_default = 262144net.core.rmem_max = 4194304net.core.wmem_max = 1048576net.core.netdev_max_backlog = 262144net.core.somaxconn = 262144net.ipv4.tcp_max_orphans = 3276800net.ipv4.tcp_max_syn_backlog = 262144net.ipv4.tcp_timestamps = 0net.ipv4.tcp_synack_retries = 1net.ipv4.tcp_syn_retries = 1net.ipv4.tcp_tw_recycle = 1net.ipv4.tcp_tw_reuse = 1net.ipv4.tcp_mem = 94500000 915000000 927000000net.ipv4.tcp_fin_timeout = 1net.ipv4.tcp_keepalive_time = 1200net.ipv4.ip_local_port_range = 9000 65500EOF/sbin/sysctl -pecho "sysctl set OK!!"#disable ipv6/sbin/chkconfig ip6tables offecho "ipv6 is disabled!"#flush iptable/sbin/iptables -F/sbin/iptables-save > /etc/sysconfig/iptables#disable selinuxsed -i '/SELINUX/s/enforcing/disabled/' /etc/selinux/configsetenforce 0#vim settingsed -i "8 s/^/alias vi='vim'/" /root/.bashrcecho 'syntax on' > /root/.vimrccat << EOF+--------------------------------------------------------------+| ===System init over=== |+--------------------------------------------------------------++---------------------------by jinong--------------------------+EOFecho "###############################################################"

# Script description:
#4. Update Basic System Software
#5. Set system clock synchronization
#6. The first statement sets the hardware clock, and the second statement sets the system clock and hardware clock synchronization.
#7. Add the maximum file descriptor to open
#8. Increase the number of system processes (threads) --> max user processes
# The difference between centos 5 and centos 6 is as long as it is in/etc/security/limits. conf sets the root soft nofile 102400 and root hard nofile102400, and the result of the corresponding uilmit-u is 102400. Pay attention to the difference here!
#9. Disable control-alt-delete
#10. Set the system language family
#11. Set SSH
#12. Set System Kernel Parameters
#13. Disable IPV6
#14. Disable iptables
#15. Disable selinux
#16. vi settings

Yum updates the package to create a cache

Yum update

Yum makecache

 

Install the lamp Environment

 

Install apache
[Root @ lamp ~] # Yum-y install httpd

Start
[Root @ lamp ~] # Chkconfig httpd on
Enable Service
[Root @ lamp ~] # Service httpd start

Install some extensions
[Root @ lamp ~] # Yum install-y httpd-manual mod_ssl mod_perl mod_auth_mysql

Check whether the port is enabled
[Root @ lamp ~] # Netstat-lnpt
Access through a browser
Http: // ip address

Install mysql database
Client Server Development Library
[Root @ lamp ~] # Yum install mysql-server mysql-devel-y
Start

[Root @ lamp ~] # Chkconfig mysqld on

Enable mysql Service
[Root @ lamp ~] # Service mysqld start

View mysql running Port
[Root @ lamp ~] # Netstat-nlpt | grep mysql

 

Install php

To allow PHP to support MySQL, we can install the php-mysql package, or use the following command to search for available php modules.

[Root @ lamp ~] # Yum install php-mysql-y


Install common php extensions

[Root @ lamp ~] # Yum search php

[Root @ lamp ~] # Yum-y install gd php-gd-devel php-xml php-common php-mbstring php-ldap php-pear php-xmlrpc php-imap

Restart httpd
[Root @ lamp ~] # Service httpd restart

Write test page
[Root @ lamp ~] # Cd/var/www/html/
[Root @ lamp html] # vim index. php

<? Php
Phpinfo ();
?>

Decompress the website

Tar zxvf web.tar.gz

Create a mysql database

Create database dedecmsv;

Mysql password

Mysqladmin-uroot passwrod '123'

The default mysql database is

/Var/lib/mysql/

Cp website data is stored in Data

Modify database Permissions

Chown-R mysql. mysql dedecmsv

Modify the mysql connection User Password

Vim data/common. inc. php

Modify php file size limit

Vim/etc/php. ini

Upload_max_filesize = 800 M

Post_max_size = 1G

Request_order = "CGP"

One problem is that it cannot be displayed as normal after replacement

Sed-I "s/192.168.0.208/192.168.0.91/g" 'grep 192.168.0.208-rl/var/www/html /'

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.