Centos 6.5(64bit)安装LNMP环境
一、修改ssh端口、关闭防火墙等
sed -i 's/^\#Port\ 22/Port 9600/g' /etc/ssh/sshd_config
service sshd restart
service iptables stop
chkconfig iptables off
sed -i 's/^SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
/usr/sbin/setenforce 0
下面这个可以不执行
rpm -q kernel-devel-$(uname -r) \
bison \
bison-devel \
ncurses \
ncurses-devel \
zlib \
zlib-devel \
openssl \
openssl-devel \
gnutls-devel \
gcc \
gcc-c++ \
mysql-devel \
make \
wget \
subversion \
libxml2-devel \
vim-enhanced \
sqlite-devel \
libtool-ltdl \
libtool-ltdl-devel \
unixODBC \
unixODBC-devel \
mysql-connector-odbc \
ntp \
cronie \
crontabs \
expect
二、安装依赖包
yum -y install bison-devel
yum -y install ncurses-devel
yum -y install zlib-devel
yum -y install openssl-devel
yum -y install gnutls-devel
yum -y install mysql-devel
yum -y install libxml2-devel
yum -y install sqlite-devel
yum -y install libtool-ltdl
yum -y install libtool-ltdl-devel
yum -y install unixODBC
yum -y install unixODBC-devel
yum -y install mysql-connector-odbc
yum -y install cronie
yum -y install expect
yum -y install sox
yum -y install tcpdump
yum -y install lzo-minilzo
三、安装Nginx
rpm -ivh nginx-*.x86_64.rpm
四、如果有mysql则移除
rpm -e mysql-devel
rpm -e mysql
rpm -e mysql-connector-odbc
五、安装mysql
tar -xf MySQL-5.6.*-1.linux_glibc2.5.x86_64.rpm-bundle.tar
rpm -ivh MySQL-client-5.6.*-1.linux_glibc2.5.x86_64.rpm
rpm -ivh MySQL-devel-5.6.*-1.linux_glibc2.5.x86_64.rpm
rpm -ivh MySQL-server-5.6.*-1.linux_glibc2.5.x86_64.rpm --force
rpm -ivh MySQL-shared-5.6.*-1.linux_glibc2.5.x86_64.rpm
rpm -ivh MySQL-shared-compat-5.6.*-1.linux_glibc2.5.x86_64.rpm
service mysql start
rpm -ivh mysql-connector-odbc-5.3.4-1.x86_64.rpm
查看mysql安装之后默认root密码
cat /root/.mysql_secret
修改mysql密码
mysql_secure_installation #设置Mysql密码,根据提示按Y 回车输入2次密码
mysql -V #查看mysql版本
mysql的事件调度器默认是关闭的
SHOW VARIABLES LIKE 'event_scheduler'; #检查
SET GLOBAL event_scheduler = ON; #全局开启
六、安装PHP环境
rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm
yum -y install php56w-common \
php56w-cli \
php56w \
php56w-pear \
php56w-dba \
php56w-devel \
php56w-mcrypt \
php56w-process \
php56w-mysql \
php56w-pecl-memcache \
php56w-imap \
php56w-pecl-gearman \
php56w-recode \
php56w-fpm \
php56w-embedded \
php56w-mbstring \
php56w-opcache \
php56w-phpdbg \
php56w-soap \
php56w-xmlrpc \
php56w-odbc \
php56w-pecl-apcu \
php56w-pecl-xdebug \
php56w-gd \
php56w-interbase \
php56w-pspell \
php56w-snmp \
php56w-ldap \
php56w-pdo \
php56w-xml \
php56w-enchant \
php56w-intl \
php56w-pgsql \
php56w-tidy
#检查安装
rpm -q php56w-common \
php56w-cli \
php56w \
php56w-pear \
php56w-dba \
php56w-devel \
php56w-mcrypt \
php56w-process \
php56w-mysql \
php56w-pecl-memcache \
php56w-imap \
php56w-pecl-gearman \
php56w-recode \
php56w-fpm \
php56w-embedded \
php56w-mbstring \
php56w-opcache \
php56w-phpdbg \
php56w-soap \
php56w-xmlrpc \
php56w-odbc \
php56w-pecl-apcu \
php56w-pecl-xdebug \
php56w-gd \
php56w-interbase \
php56w-pspell \
php56w-snmp \
php56w-ldap \
php56w-pdo \
php56w-xml \
php56w-enchant \
php56w-intl \
php56w-pgsql \
php56w-tidy
修改部分php.ini设置
sed -i 's/^upload_max_filesize\ =\ 2M/upload_max_filesize\ =\ 50M /g' /etc/php.ini
sed -i 's/^;\ max_input_vars\ =\ 1000/\ max_input_vars\ =\ 2000 /g' /etc/php.ini
sed -i 's/^;date.timezone\ =/date.timezone=Asia\/Shanghai/g' /etc/php.ini
nginx配置目录
/etc/nginx/conf.d
加入开机启动项
chkconfig nginx on
chkconfig php-fpm on
chkconfig mysql on
相关重启命令
service nginx start
service php-fpm start
service mysql start