首页 > 代码库 > lnmp部署 -----1
lnmp部署 -----1
基本环境
系统 : centos 6.4
nginx-1.2.0
mysql-5.5.13
php-5.4.9
[root@localhost ~]# service httpd stop //确认httpd服务已关闭
[root@localhost ~]# service mysqld stop //确认系统中的mysql数据库没有启动
[root@localhost ~]# yum -y groupinstall "Development //安装开发环境和开发库
libraries" "Development tools" "X Software Development“
[root@localhost ~]# yum -y install gcc openssl-devel pcre-
devel zlib-devel
[root@localhost ~]# groupadd www // 创建nginx用户
[root@localhost ~]# useradd -g www www
安装Nginx
[root@localhost ~]# tar -zxvf nginx-1.2.0.tar.gz
[root@localhost ~]# cd nginx-1.2.0
[root@localhost nginx-1.2.0]# ./configure \
> --prefix=/usr/local/nginx \
> --pid-path=/usr/local/nginx/nginx.pid \
> --user=www --group=www \
> --with-http_ssl_module --with-http_flv_module \
> --with-http_stub_status_module \
> --with-http_gzip_static_module \
> --http-client-body-temp-path=/usr/local/nginx/client \
> --http-proxy-temp-path=/usr/local/nginx/proxy \
> --http-fastcgi-temp-path=/usr/local/nginx/fcgi \
> --http-uwsgi-temp-path=/usr/local/nginx/uwsgi \
> --http-scgi-temp-path=/usr/local/nginx/scgi \
> --with-pcre
[root@localhost nginx-1.2.0]# make
[root@localhost nginx-1.2.0]# make install
启动Nginx服务
[root@localhost mysql]# /usr/local/nginx/sbin/nginx -c \
> /usr/local/nginx/conf/nginx.conf
[root@localhost mysql]# netstat -utnalp | grep :80
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 32428/nginx
安装cmake
[root@localhost ~]# tar -zxvf cmake-2.8.10.2.tar.gz
[root@localhost ~]# cd cmake-2.8.10.2
[root@localhost cmake-2.8.10.2]# ./bootstrap \
> --prefix=/usr/local/cmake
[root@localhost cmake-2.8.10.2]# make
[root@localhost cmake-2.8.10.2]# make install
[root@localhost cmake-2.8.10.2]# /usr/local/cmake/bin/cmake --version
ncmake version 2.8.10.2
安装Mysql
[root@localhost ~]# groupadd mysql
[root@localhost ~]# useradd -g mysql mysql
[root@localhost ~]# tar -zxvf mysql-5.5.13.tar.gz
[root@localhost ~]# cd mysql-5.5.13
[root@localhost mysql-5.5.13]# /usr/local/cmake/bin/cmake \
> -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
> -DSYSCONFDIR=/etc -DMYSQL_DATADIR=/usr/local/mysql/data \
> -DMYSQL_TCP_PORT=3306 \
> -DMYSQL_UNIX_ADDR=/tmp/mysqld.sock \
> -DMYSQL_USER=mysql -DEXTRA_CHARSETS=all \
> -DWITH_READLINE=1 -DWITH_SSL=system \
> -DWITH_EMBEDDED_SERVER=1 \
> -DENABLED_LOCAL_INFILE=1 \
> -DWITH_INNOBASE_STORAGE_ENGINE=1
[root@localhost mysql-5.5.13]# make
[root@localhost mysql-5.5.13]# make install
数据库初始化
[root@localhost ~]# cd /usr/local/mysql/
[root@localhost mysql]# chown -R mysql.mysql .
[root@localhost mysql]# ./scripts/mysql_install_db --user=mysql
[root@localhost mysql]# ls data/
mysql performance_schema test
[root@localhost ~]# cd mysql-5.5.13
[root@localhost mysql-5.5.13]# cp support-files/my-medium.cnf /etc/my.cnf //mysql配置文件
[root@localhost mysql-5.5.13]# cp support-files/mysql.server /etc/init.d/mysqld // 启动脚本
[root@localhost mysql-5.5.13]# chmod +x /etc/init.d/mysqld
[root@localhost ~]# /etc/init.d/mysqld start|stop|status
[root@localhost ~]# vim ~/.bash_profile
PATH=$PATH:$HOME/bin:/usr/local/mysql/bin/ //mysql命令加入到系统命令
export PATH
[root@localhost ~]# source ~/.bash_profile
[root@localhost ~]# cat /etc/ld.so.conf
include ld.so.conf.d/*.conf
/usr/local/mysql/lib/
[root@localhost ~]# ldconfig
本文出自 “Linux学习心得” 博客,请务必保留此出处http://8068131.blog.51cto.com/8058131/1536390