澳门威尼斯人注册网址【官网首页】
做最好的网站

5下编译安装Nginx1,x下LNMP环境源码编译安装及配置

来源:http://www.ogcoffee123.com 作者: 计算机网络 人气:122 发布时间:2019-11-06
摘要:vi /etc/profile #把mysql服务加入系统环境变量:在最后添加下面这一行 检查apache配置参数;-l 列出加载的静态模块 -M列出所有加载的模块; [root@localhost ~]# apachectl -t Syntax OK [root@localhost ~

vi /etc/profile #把mysql服务加入系统环境变量:在最后添加下面这一行

检查apache配置参数;-l 列出加载的静态模块 -M列出所有加载的模块;
[root@localhost ~]# apachectl -t
Syntax OK
[root@localhost ~]# apachectl -l
[root@localhost ~]# apachectl -M

3.源码编译安装php-5.6.30

官网下载php-5.6.30

http://php.net/downloads.php#v5.6.30

yum安装依赖包

yum install gcc-c++ gd libxml2-devel libjpeg-devel libpng-devel net-snmp-devel curl-devel libxslt-devel pcre-devel libjpeg libpng libxml2 libcurl4-openssl-dev libcurl-devel libcurl freetype-config freetype freetype-devel unixODBC libxslt -y

开始编译安装php-5.6.30

tar -zxf php-5.6.30.tar.gz

cd php-5.6.30

./configure --prefix=/usr/local/php-5.6.30 --with-curl --with-gd --with-gettext --with-iconv-dir --with-kerberos --with-libdir=lib64 --with-libxml-dir --with-mysql --with-mysqli --with-openssl --with-pcre-regex --with-pdo-mysql --with-pdo-sqlite --with-pear --with-png-dir --with-freetype-dir --with-jpeg-dir --with-xmlrpc --with-xsl --with-zlib --enable-fpm --enable-bcmath --enable-libxml --enable-inline-optimization --enable-gd-native-ttf --enable-mbregex --enable-mbstring --enable-opcache --enable-pcntl --enable-shmop --enable-soap --enable-sockets --enable-sysvsem --enable-xml && make && make install

从php源码包复制php.ini配置文件到php安装目录,并做系统的软连接

cp -a /root/php-5.6.30/php.ini-production /usr/local/php-5.6.30/etc/php.ini
ln -s /usr/local/php-5.6.30/etc/php.ini /etc/php.ini

从php源码包复制php-fpm.conf配置文件到php安装目录,并做系统的软连接

cp -a /usr/local/php-5.6.30/etc/php-fpm.conf.default /usr/local/php-5.6.30/etc/php-fpm.conf
ln -s /usr/local/php-5.6.30/etc/php-fpm.conf /etc/php-fpm.conf

修改php-fpm.conf配置参数

sed -i '25s/;//g' /usr/local/php-5.6.30/etc/php-fpm.conf

sed -i '303s/disable_functions =/disable_functions = passthru,exec,system,chroot,scandir,chgrp,chown,shell_exec,proc_open,proc_get_status, ini_alter,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,esca peshellcmd,dll,popen,disk_free_space,checkdnsrr,checkdnsrr,getservbyname,getservbyport,disk_total_space,p osix_ctermid,posix_get_last_error,posix_getcwd, posix_getegid,posix_geteuid,posix_getgid, posix_getgrgid, posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid, posix_getppid,pos ix_getpwnam,posix_getpwuid, posix_getrlimit, posix_getsid,posix_getuid,posix_isatty, posix_kill,posix_mkf ifo,posix_setegid,posix_seteuid,posix_setgid, posix_setpgid,posix_setsid,posix_setuid,posix_strerror,posi x_times,posix_ttyname,posix_uname/g' /usr/local/php-5.6.30/etc/php.ini

sed -i '936s/;date.timezone =/date.timezone = PRC/g' /usr/local/php-5.6.30/etc/php.ini

sed -i '151s/; short_open_tag/short_open_tag = ON/g' /usr/local/php-5.6.30/etc/php.ini

sed -i '1905s/;opcache.enable=0/opcache.enable=1/g' /usr/local/php-5.6.30/etc/php.ini

sed -i '1908s/;opcache.enable_cli=0/opcache.enable_cli=0/g' /usr/local/php-5.6.30/etc/php.ini

sed -i '$a zend_extension=opcache.so' /usr/local/php-5.6.30/etc/php.ini

sed -i '509s/;env[PATH] = /usr/local/bin:/usr/bin:/bin/env[PATH] = /usr/local/bin:/usr/bin:/bin/:/usr/local/php5.6.30/bin/g' /usr/local/php-5.6.30/etc/php-fpm.conf

复制php启动脚本

cp -a /root/php-5.6.30/sapi/fpm/php-fpm /etc/init.d/

启动php

/etc/init.d/php-fpm

查看9000端口

netstat -ntpl |grep "9000"

(停止php)

killall php-fpm

测试nginx+php

mkdir /opt/test

echo "<?php
Phpinfo();
?>" > /opt/test/index.php

nginx配置

vim /usr/local/nginx/conf/conf.d/test.conf

server {
        listen          80;
        server_name     192.168.1.2;
        index           index.php;
        root            /opt/test;

        location /
        {
                try_files $uri $uri/ /index.php?$args;
        }

        location ~ ^(.+.php)(.*)$ {
                fastcgi_split_path_info ^(.+.php)(.*)$;
                include fastcgi.conf;
                fastcgi_pass  127.0.0.1:9000;
                fastcgi_index index.php;
                fastcgi_param  PATH_INFO          $fastcgi_path_info;
        }
}

浏览器输入192.168.1.2查看php页面

LNMP环境搭建(Discuz论坛)  http://www.linuxidc.com/Linux/2016-03/129334.htm 

Ubuntu 14.04下apt-get方法安装LNMP环境  http://www.linuxidc.com/Linux/2016-07/133683.htm 

CentOS 7源码编译安装PHP5.6和Nginx1.7.9及MySQL(搭建LNMP环境) http://www.linuxidc.com/Linux/2015-12/126200.htm 

Ubuntu 14.04 LTS 安装 LNMP NginxPHP5 (PHP-FPM)MySQL  http://www.linuxidc.com/Linux/2014-05/102351.htm 

CentOS 6.8 编译安装LNMP 简述  http://www.linuxidc.com/Linux/2017-05/143667.htm 

Ubuntu 16.04 下源码配置LNMP开发环境 http://www.linuxidc.com/Linux/2016-09/135381.htm 

CentOS 7源码编译安装PHP5.6和Nginx1.7.9及MySQL(搭建LNMP环境) http://www.linuxidc.com/Linux/2015-12/126200.htm 

CentOS 7源码安装最新版LNMP环境 http://www.linuxidc.com/Linux/2015-04/116058.htm 

CentOS 6.8 安装LNMP环境(Linux+Nginx+MySQL+PHP)   http://www.linuxidc.com/Linux/2017-04/142880.htm 

Ubuntu系统下LNMP环境的搭建  http://www.linuxidc.com/Linux/2017-04/142610.htm 

编译LNMP之Nginx+php-fpm  http://www.linuxidc.com/Linux/2017-10/147535.htm 

Ubuntu 16.04 LTS下LNMP环境配置简述  http://www.linuxidc.com/Linux/2017-05/144252.htm 

本文永久更新链接地址:http://www.linuxidc.com/Linux/2017-12/149714.htm

图片 1

 

[root@localhost src]# tar zxf httpd-2.4.12.tar.gz 
[root@localhost src]# cd httpd-2.4.12
[root@localhost httpd-2.4.12]# ./configure --prefix=/usr/local/apache2 --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util/ --with-pcre --enable-mods-shared=most --enable-so
[root@localhost httpd-2.4.12]# echo $?
0

1.操作系统:CentOS 6.x ( 双核4G、硬盘至少20G)

然后输入2次密码

Ubuntu 14.10 下安装 LAMP 服务图文详解  http://www.linuxidc.com/Linux/2014-12/110082.htm

二:源码编译安装配置nginx、mysql、php

根据提示按Y 回车

编译安装apache

1.源码编译安装nginx-1.8.1

官网下载nginx-1.8.1.tar.gz

http://nginx.org/en/download.html

下载pcre-8.40.tar.gz

https://ftp.pcre.org/pub/pcre/

yum安装依赖包

yum install perl gcc-c++ make elinks zlib-devel openssl openssl-devel -y

pcre 解压即可

tar -zxf pcre-8.4.0.tar.gz

开始编译安装nginx-1.8.1

tar -zxf nginx-1.8.1.tar.gz

cd nginx-1.8.1

./configure --prefix=/usr/local/nginx --with-pcre=/root/pcre-8.40 --with-http_stub_status_module --with-http_ssl_module

make

make install

修改nginx主配置文件,让其包含/usr/local/nginx/conf/conf.d下的所有*.conf文件

mkdir /usr/local/nginx/conf/conf.d

sed -i '116s/$/include /usr/local/nginx/conf/conf.d/*.conf;/g' /usr/local/nginx/conf/nginx.conf

至此nginx安装完毕

启动nginx

/usr/local/nginx/sbin/nginx

查看80端口

netstat -ntpl |grep "80"

关闭防火墙/etc/init.d/iptables stop 或者防火墙打开80端口

(关闭nginx)

killall nginx

 二、系统约定

[root@localhost src]# tar zxf apr-1.5.2.tar.gz 
[root@localhost src]# cd apr-1.5.2
[root@localhost apr-1.5.2]# ./configure --prefix=/usr/local/apr
[root@localhost apr-1.5.2]# make && make install
[root@localhost apr-1.5.2]# echo $?
0

2.应用软件:nginx-1.8.1、mysql-5.6.29、php-5.6.30

export PATH=$PATH:/usr/local/mysql/bin

一直都是在虚拟机中做实验,头一次在真机安装CentOS6.6 x86_64位系统,并安装LAMP环境。提前安装必备的软件包,在安装过程中未出现错误;可以使用一键安装LAMP脚本执行。

一:环境介绍

CentOS 6.4安装配置Nginx+Pcre+php-fpm http://www.linuxidc.com/Linux/2013-08/88984.htm

检查开发环境,没有安装的话使用yum安装;
[root@localhost ~]# rpm -qa gcc cmake pcre-devel libmcrypt
libmcrypt-2.5.8-9.el6.x86_64
gcc-4.4.7-11.el6.x86_64
cmake-2.8.12.2-4.el6.x86_64
pcre-devel-7.8-6.el6.x86_64

2.源码编译安装mysql-5.6.29

官网下载mysql-5.6.29.tar.gz

https://downloads.mysql.com/archives/community/

图片 2 

下载cmake-3.4.0

https://cmake.org/files/v3.4/cmake-3.4.0.tar.gz

yum安装依赖包

yum install gcc-c++ ncurses-devel perl-Module-Install.noarch libtool openssl-devel make -y

安装cmake

tar -zxf cmake-3.4.0.tar.gz

cd cmake-3.4.0

./configure && make && make install

cmake安装完毕

开始编译安装mysql-5.6.29

tar -zxf mysql-5.6.29.tar.gz

cd mysql-5.6.29

cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DSYSCONFDIR=/usr/local/mysql/data -DMYSQL_DATADIR=/usr/local/mysql/data -DMYSQL_UNIX_ADDR=/usr/local/mysql/mysqld.sock -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_PARTITION_STORAGE_ENGINE=1 -DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DWITH_FEDERATED_STORAGE_ENGINE=1 -DWITH_PERFSCHEMA_STORAGE_ENGINE=1 -DENABLED_LOCAL_INFILE=1 -DMYSQL_TCP_PORT=3306 -DWITH_EXTRA_CHARSETS=all -DWITH_DEBUG=0 -DENABLE_DEBUG_SYNC=0 -DWITH_SSL=system -DWITH_ZLIB=system -DWITH_READLINE=1 -DZLIB_INCLUDE_DIR=/usr -DWITH_READLINE=1
make
make install

创建mysql系统用户组和用户,并将mysql安装目录赋予root组和root用户

groupadd mysql

useradd -g mysql -s /sbin/nologin -M mysql

chown mysql.mysql -R /usr/local/mysql

初始化mysql数据库

/usr/local/mysql/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data

复制mysql启动脚本

cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld

直接执行修改文件

sed -i '46s/$//usr/local/mysql/g' /etc/init.d/mysqld
sed -i '47s/$//usr/local/mysql/data/g' /etc/init.d/mysqld
sed -i '263s/datadir/basedir/g' /etc/init.d/mysqld

写入mysql配置文件my.cnf

echo "[mysqld]

basedir=/usr/local/mysql
datadir=/usr/local/mysql/data
socket=/usr/local/mysql/mysqld.sock
user = mysql
port = 3306
server_id = 2
#log-bin = mysql-bin
#log_bin_index = binlog.index
character_set_server = utf8
#lower_case_table_names = 1
#binlog_ignore_db = mysql
#replicate-do-db = mysql
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
innodb_file_per_table=1

[mysql.server]
character_set_server = utf8
socket=/usr/local/mysql/mysqld.sock

[client]
socket=/usr/local/mysql/mysqld.sock
default-character-set = utf8

[mysqld_safe]
character_set_server = utf8

[mysql]
socket=/usr/local/mysql/mysqld.sock
default-character-set = utf8


[mysqldump]
socket=/usr/local/mysql/mysqld.sock
default-character-set = utf8


[mysqladmin]
socket=/usr/local/mysql/mysqld.sock
character_set_server = utf8
" > /usr/local/mysql/my.cnf

将mysql加入centos系统环境变量
vim /etc/profile

echo -e "export MYSQL_HOME="/usr/local/mysql"
export PATH="$PATH:$MYSQL_HOME/bin"" >> /etc/profile

刷新环境变量

source /etc/profile

至此mysql安装完毕

启动mysql

/etc/init.d/mysqld start

查看3306端口

netstat -ntpl |grep "3306"

(停止或重启mysql)

/etc/init.d/mysqld stop

/etc/init.d/mysqld restart

shell界面进入mysql 删除默认的多余root账户

mysql -uroot -p


delete from mysql.user where Host='::1';
delete from mysql.user where Host='localhost.localdomain';
delete from mysql.user where User='';

将所有的root用户更改密码

update mysql.user set password=password("root") where user="root";

创建一个可以从其他任何地方访问mysql的用户 密码为root

grant all privileges on *.* to 'root'@'%' identified by "root";

对用户进行增删改后需要重启数据库或者执行flush privileges;

查看mysql用户

select user,host,password from mysql.user;

groupadd mysql #添加mysql组

配置php与apache
1、修改AddType参数,红色为新添加
[root@localhost php-5.6.8]# vi /usr/local/apache2/conf/httpd.conf
    # AddType allows you to add to or override the MIME configuration
    #AddType application/x-gzip .tgz
    AddType application/x-compress .Z
    AddType application/x-gzip .gz .tgz
    AddType application/x-httpd-php .php
    #AddType text/html .shtml

继续按Y 回车,直到设置完成

4、测试解析php,在/usr/local/apache2/htdocs/目录下,写一个测试php文件
[root@localhost php-5.6.8]# cat /usr/local/apache2/htdocs/test.php
<?php
echo "PHP解析正常n";
?>
[root@localhost htdocs]# /etc/init.d/httpd restart
[root@localhost htdocs]# curl localhost/test.php
PHP解析正常

1、下载nginx(目前稳定版)

2、下载pcre (支持nginx伪静态)
ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.31.tar.gz
4、下载MySQL5.5.35

5、下载php-5.5.7(目前最新版)

6、下载cmake(MySQL编译工具)

7、下载libmcrypt(PHPlibmcrypt模块)

更多CentOS相关信息见CentOS 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=14

-DWITH_EXTRA_CHARSETS=all

初始化数据库
# cd /usr/local/mysql/scripts/ 
#  ./mysql_install_db --basedir=/usr/local/mysql/ --datadir=/data/mysql/ --user=mysql

CentOS 6.2实战部署Nginx+MySQL+PHP http://www.linuxidc.com/Linux/2013-09/90020.htm

安装LAMP环境之前需要安装必备的包
yum install wget gcc gcc-c++ make re2c curl curl-devel libxml2 libxml2-devel libjpeg libjpeg-devel libpng libpng-devel libmcrypt libmcrypt-devel zlib zlib-devel openssl openssl-devel freetype freetype-devel gd gd-devel perl perl-devel ncurses ncurses-devel bison bison-devel libtool gettext gettext-devel cmake bzip2 bzip2-devel pcre pcre-devel

五、安装cmake及MySQL:

# service mysqld start
# chkconfig --add mysqld
# chkconfig mysqld on

./scripts/mysql_install_db --user=mysql #生成mysql系统数据库

编译安装apr-util

安装MySQL

[root@localhost src]# tar zxf apr-util-1.5.4.tar.gz 
[root@localhost src]# cd apr-util-1.5.4
[root@localhost apr-util-1.5.4]# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
[root@localhost apr-util-1.5.4]# make && make install
[root@localhost apr-util-1.5.4]# echo $?
0

basedir = /usr/local/mysql #MySQL程序安装路径

编辑mysqld启动脚本,找到basedir和datadir添加路径;
#vi /etc/init.d/mysqld
basedir=/usr/local/mysql
datadir=/data/mysql

图片 3

添加iptables规则,允许80端口,并保存防火墙设置。
# iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
# /etc/init.d/iptables save

到此,mysql安装完成!

CentOS 7下搭建LAMP平台环境  http://www.linuxidc.com/Linux/2015-06/118818.htm

reboot #需要重启系统,等待系统重新启动之后继续在终端命令行下面操作

编译安装apr

mysql_secure_installation #设置Mysql密码

修改时区
[root@localhost php-5.6.8]# vi /usr/local/php/etc/php.ini 
date.timezone =Asia/Shanghai

datadir = /data/mysql #MySQl数据库存放目录

本文永久更新链接地址:http://www.linuxidc.com/Linux/2015-07/120403.htm

更多详情见请继续阅读下一页的精彩内容: http://www.linuxidc.com/Linux/2014-06/103266p2.htm

至此LAMP环境搭建完毕。

图片 4

图片 5

vi /etc/rc.d/init.d/mysql #编辑

apache执行命令目录加入配置文件,生效;
[root@localhost ~]# vi /etc/profile
PATH=$PATH:/usr/local/apache2/bin
[root@localhost ~]# . /etc/profile

cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql
-DMYSQL_UNIX_ADDR=/tmp/mysql.sock
-DDEFAULT_CHARSET=utf8
-DDEFAULT_COLLATION=utf8_general_ci

编译安装apache2.4.12
CentOS6 yum安装的apr版本已经不适用httpd-2.4版本了。所以,需要源码编译安装apr以及apr-util
#cd /usr/local/src/
#wget
#wget

make && make install

Linux版本及内核版本
[root@localhost ~]# cat /etc/issue
CentOS release 6.6 (Final)
Kernel r on an m
[root@localhost ~]# uname -r
2.6.32-504.el6.x86_64

vi /etc/selinux/config
#SELINUX=enforcing #注释掉
#SELINUXTYPE=targeted #注释掉
SELINUX=disabled #增加
:wq 保存,退出
reboot #重启系统

LAMP平台安装Xcache和Memcached加速网站运行  http://www.linuxidc.com/Linux/2015-06/118835.htm 

下载完成后,传送到opt目录下,当然也可以直接在opt目录下使用wget下载;

3、修改severname,红色为新添加
#ServerName www.example.com:80
ServerName localhost:80

cp ./support-files/my-huge.cnf /etc/my.cnf #拷贝配置文件(注意:如果/etc目录下面默认有一个my.cnf,直接覆盖即可)

Ubuntu 14.04 配置 LAMP+phpMyAdmin PHP(5.5.9)开发环境  http://www.linuxidc.com/Linux/2014-10/107924.htm

 

拷贝php配置文件
[root@localhost php-5.6.8]# cp /usr/local/src/php-5.6.8/php.ini-production /usr/local/php/etc/php.ini

三、下载软件工具包:

# vi /etc/profile
PATH=$PATH:/usr/local/mysql/bin
export PATH
# source /etc/profile

或者直接修改密码/usr/local/mysql/bin/mysqladmin -u root -p password "123456" #修改密码

或者写一个phpinfo();

useradd -g mysql mysql -s /bin/false #创建用户mysql并加入到mysql组,不允许mysql用户直接登录系统

拷贝启动脚本

mkdir -p /data/mysql #创建MySQL数据库存放目

添加iptables规则,允许3306端口,并保存防火墙设置。
12 # iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT
# /etc/init.d/iptables save

下面这行把myslq的库文件链接到系统默认的位置,这样你在编译类似PHP等软件时可以不用指定mysql的库文件地址。

设置环境变量,最后一行加入以下内容,保存退出后,source生效;

 

编译安装php 5.6.8
[root@localhost src]# tar zxvf php-5.6.8.tar.gz 
[root@localhost src]# cd php-5.6.8
[root@localhost php-5.6.8]# ./configure  --prefix=/usr/local/php  --with-apxs2=/usr/local/apache2/bin/apxs  --with-config-file-path=/usr/local/php/etc  --with-mysql=/usr/local/mysql  --with-libxml-dir  --with-gd  --with-jpeg-dir  --with-png-dir  --with-freetype-dir  --with-iconv-dir  --with-zlib-dir  --with-bz2  --with-openssl  --with-mcrypt  --enable-soap  --enable-gd-native-ttf  --enable-mbstring  --enable-sockets  --enable-exif  --disable-ipv6 
[root@localhost php-5.6.8]# make && make install
[root@localhost php-5.6.8]# echo $?
0

待安装完以后开始配置MySQL:

软件版本:
apache 2.4.12版本下载
mysql 5.6.24版本下载
php5.6.8 版本下载
apr apr-util下载地址:
libmcrypt下载地址:ftp://mcrypt.hellug.gr/pub/crypto/mcrypt/libmcrypt

四、yum安装常用编译工具及库文件:

DELL R420服务器配置 E5-2403双cpu,4核心8线程;
[root@localhost ~]# grep "model name" /proc/cpuinfo |uniq
model name: Intel(R) Xeon(R) CPU E5-2403 v2 @ 1.80GHz
[root@localhost ~]# grep  -c "processor" /proc/cpuinfo
8
[root@localhost ~]# grep "core id" /proc/cpuinfo |sort |uniq|wc -l
4

ln -s /usr/local/mysql/include/mysql /usr/include/mysql

# cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld

vi /etc/my.cnf #编辑配置文件,在 [mysqld] 部分增加下面一行

2、修改index.html,红色为新添加
<IfModule dir_module>
    DirectoryIndex index.html index.php
</IfModule>

yum install make apr* autoconf automake bzip2 bzip2-devel curl curl-devel gcc gcc-c++ gcc-g77 e2fsprogs e2fsprogs-devel zlib* zlib-devel openssl openssl-devel pcre-devel gd gd-devel kernel keyutils patch perl kernel-headers compat* mpfr cpp glibc libgomp libstdc++-devel ppl cloog-ppl keyutils-libs-devel libcom_err-devel libsepol-devel libselinux-devel krb5-devel zlib-devel libXpm* libvpx libjpeg libpng zlib libXpm libXpm-devel t1lib libt1-devel freetype freetype-devel libpng* libpng10 libpng10-devel libpng-devel php-common php-gd ncurses* ncurses-devel libtool* libtool-libs libxml2-devel patch glibc glibc-devel glib2 glib2-devel krb5 krb5-devel libevent libevent-devel libidn libidn-devel nss_ldap openldap openldap-clients openldap-devel openldap-servers openssl openssl-devel pspell-devel net-snmp* net-snmp-devel -y

拷贝配置文件,修改my.cnf
#  cp /usr/local/mysql/my.cnf /etc/my.cnf 
#  vi /etc/my.cnf
[mysqld]
user=mysql 
datadir=/data/mysql
default-storage-engine=MyISAM

mkdir -p /usr/local/mysql #创建MySQL安装目录

编辑启动脚本,更改权限,并加入系统服务,设置开机启动;
[root@localhost apache2]# vi /etc/init.d/httpd
[root@localhost apache2]# chmod 755 /etc/init.d/httpd
[root@localhost apache2]# chkconfig --add httpd
[root@localhost apache2]# chkconfig httpd on

chown -R mysql:mysql /data/mysql #设置MySQL数据库目录权限

启动mysqld服务,并加入开机启动;

cd /opt
tar zxvf mysql-5.5.35.tar.gz
cd mysql-5.5.35

CentOS 6.5系统安装配置LAMP(Apache+PHP5+MySQL)服务器环境 http://www.linuxidc.com/Linux/2014-12/111030.htm

cp ./support-files/mysql.server /etc/rc.d/init.d/mysql #把Mysql加入系统启动

创建mysql用户,数据库目录,更改权限
1234 # useradd -M -s /sbin/nologin mysql
# mkdir -p /data/mysql 
# chown -R mysql:mysql /data/mysql/
# chown -R mysql:mysql /usr/local/mysql/

:wq! #保存退出

编译安装mysql 5.6.24
#cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/data/mysql -DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock -DSYSCONFDIR=/etc -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_MEMORY_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DMYSQL_TCP_PORT=3306 -DENABLED_LOCAL_INFILE=1 -DWITH_PARTITION_STORAGE_ENGINE=1 -DEXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci
# make && make install 
# echo $?
# 0

-DWITH_MYISAM_STORAGE_ENGINE=1
-DWITH_INNOBASE_STORAGE_ENGINE=1
-DWITH_MEMORY_STORAGE_ENGINE=1
-DWITH_READLINE=1
-DENABLED_LOCAL_INFILE=1
-DMYSQL_DATADIR=/data/mysql
-DMYSQL_USER=mysql
-DMYSQL_TCP_PORT=3306
-DSYSCONFDIR=/etc
-DINSTALL_SHAREDIR=share

CentOS 6.3下Nginx性能调优 http://www.linuxidc.com/Linux/2013-09/89656.htm

datadir = /data/mysql #添加MySQL数据库路径

一、准备工作

软件源代码包存放位置:/opt

环境说明:CentOS 6.5 32位 Nginx1.40 Php5.57 MySQL5.5.35

:wq! #保存退出

cd /usr/local/mysql

搭建基于Linux6.3+Nginx1.2+PHP5+MySQL5.5的Web服务器全过程 http://www.linuxidc.com/Linux/2013-09/89692.htm

使用Nginx搭建WEB服务器 http://www.linuxidc.com/Linux/2013-09/89768.htm

源码包编译安装位置:/usr/local/软件名字

service mysqld start #启动

service mysqld restart #重启

等所有安装包下载安装完以后就可以开始安装啦·

安装cmake
cd /opt && tar zxvf cmake-2.8.8.tar.gz
cd cmake-2.8.8
./configure && make && make install

关闭selinux:

chkconfig mysql on #加入开机启动

CentOS 6.3下配置Nginx加载ngx_pagespeed模块 http://www.linuxidc.com/Linux/2013-09/89657.htm

Nginx搭建视频点播服务器(仿真专业流媒体软件) http://www.linuxidc.com/Linux/2012-08/69151.htm

 

chmod 755 /etc/init.d/mysql #增加执行权限

配置防火墙,允许防火墙通过22(sshd)、80(WEB)、3306(MYSQL)端口
iptables -A INPUT -p tcp --dport 80 -j ACCEPT
iptables -A INPUT -p tcp --dport 3306 -j ACCEPT
iptables -A INPUT -p tcp --dport 22 -j ACCEPT
iptables -A OUTPUT -p tcp --sport 22 -j ACCEPT
/etc/rc.d/init.d/iptables save #保存配置

本文由澳门威尼斯人注册网址发布于 计算机网络,转载请注明出处:5下编译安装Nginx1,x下LNMP环境源码编译安装及配置

关键词:

上一篇:没有了

下一篇:支付微信门户及使用

最火资讯