LAMP+SSL
时间:2010-04-28 来源:tony_wangzt
呵呵,文档是转marion的文档,我改了ssl生成证书的一块和报错信息
1,安装mysql
#groupadd mysql
#useradd -g mysql mysql
#tar xvzf mysql-*
#cd mysql-*
#./configure --prefix=/usr/local/mysql
--enable-thread-safe-client
--enable-local-infile
--with-charset=gbk
--with-extra-charset=all
--with-low-memory
#make
#make install
#cp support-files/my-medium.cnf /etc/my.cnf
#cd /usr/local/mysql
#chown -R mysql .
#chgrp -R mysql .
#bin/mysql_instatll_db --user=mysql
#chown -R root .
#chown -R mysql var
#bin/mysqld_safe --user=mysql &
添加开机启动
# echo "/usr/local/mysql/bin/mysqld_safe " >> /etc/rc/local
测试一下
/usr/local/mysql/bin/mysqladmin version
2,安装 zlib
# tar zxvf zlib*
#cd zlib*
#./configure --prefix=/usr/local/zlib
#make
#make install
3,安装openssl
#tar xvzf openssl*
#cd openssl*
#./config shared zlib
#make
则是openssl-devel包没有,安装即可
#make test
#make install
#rm /usr/bin/openssl
#rm /usr/includes/openssl
#ln -sv /usr/local/ssl/bin/openssl /usr/bin/openssl
#ln -sv /usr/local/ssl/includes/opensll /usr/includes/openssl
#echo "/usr/local/ssl/lib" >> /etc/ld.so.conf
#ldconfig -v
4,安装httpd
#tar xvzf httpd*
#cd httpd*
#./configure --prefix=/usr/local/apache --sysconfdir=/etc/httpd --enable-so --enable-ssl
--with-ssl=/usr/local/ssl --enable-track-vars --enable-rewrite
--with-z-dir=/usr/local/zlib --enable-mods-shared=most
#make
#make install
#/usr/local/apache/bin/apachectl start
则是因为没有找到openssl的lib库 echo"/usr/local/ssl/lib" >> /etc/ld.so.conf
ldconfig -v 即可
#echo "/usr/local/apache/bin/apachectl start" >> /etc/rc.local
5,安装libpng
#tar xvzf libpng*
#cd libpng*
#cp scripts/makefile.linux makefile
#make
#make install
6,安装freetype*
#tar xvzf freetype*
#cd freetype*
#mkdir -p /usr/local/freetype
#./configure --prefix=/usr/local/freetype
#make
#make install
7,安装jpegsrc.v6b
#tar xvzf jpegsrc.v6g
#cd jpegsrc.v6g
#./configure --prefix=/usr/local/jpeg6 --enable-shared --enable-static
#make
#mkdir -pv /usr/local/jpeg6 /usr/local/jpeg6/bin /usr/local/jpeg6/lib /usr/local/jpeg6/include /usr/local/jpeg6/man/man1
#make install
#make install-lib
8安装libxml2
#tar xvzf libxml2
#cd libxml2
#make -p /usr/local/libxml2
#./configure --prefix=/usr/local/libxml2
#make
#make install
#cp xml2-config /usr/bin
9安装GD库
#tar xvzf gd*
#cd gd
#./configure --prefix=/usr/local/gd2 --with-jpeg=/usr/local/jpeg6
--with-png=/usr/local/lib --with-zlib=/usr/local/zlib
--with-freetype=/usr/local/freetype
#make
#make install
10 安装php
#tar xzvf php
#cd php
#./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs
--with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config
--with-xml=/usr/local/libxml2
--with-png=/usr/local/lib --with-jpeg=/usr/local/jepg6 --with-zlib=/usr/local/zlib
--with-freetype=/usr/local/freetype --with-gd=/usr/local/gd2 --enable-track-vars
--enable-mbstring=all
#make
#make install
#cp php.ini-dist /usr/local/php/lib/php.ini
编辑/etc/httpd/httpd.conf
找到LoadModule php5_module modules/libphp5.so
添加AddType application/x-httpd-php .php
AddType application/x-httpd-source .phps
找到index.html 在前面加上index.php
vi /usr/local/apache/htdocs/index.php
<?
phpinfo();
?>
/usr/local/apache/bin/apactl restart
访问http://IP测试
11.安装ssl
# vi /usr/local/apache/conf/httpd.conf
查找 ssl的配置文件存放路径
Includes conf/extra/httpd-ssl.conf 并将注释去掉,使其开启
#vi /usr/local/apache/conf/extra/httpd-ssl.conf 编译ssl配置
查找证书文件的存放闻之
SSLCertificateFile "/usr/local/apache/conf/server.crt"
SSLCertificateKeyFile "/usr/local/apache/conf/server.key"
#cd /usr/local/apache/conf/
#openssl genrsa -out /usr/local/apache/conf/server.key 1024
#openssl req -new -x509 -key /usr/local/apache/conf/server.key -out /usr/local/apache/conf/server.crt
再重启httpd服务器就好了
1,安装mysql
#groupadd mysql
#useradd -g mysql mysql
#tar xvzf mysql-*
#cd mysql-*
#./configure --prefix=/usr/local/mysql
--enable-thread-safe-client
--enable-local-infile
--with-charset=gbk
--with-extra-charset=all
--with-low-memory
如果checking for tgetent in -lcurses... no checking for tgetent in -ltermcap... no checking for tgetent in -ltinfo... no checking for termcap functions library... configure: error: No curses/termcap library found 是由于没有安装ncurses-devel库,安装即可 |
#make install
#cp support-files/my-medium.cnf /etc/my.cnf
#cd /usr/local/mysql
#chown -R mysql .
#chgrp -R mysql .
#bin/mysql_instatll_db --user=mysql
#chown -R root .
#chown -R mysql var
#bin/mysqld_safe --user=mysql &
如果[root@mail mysql]# Starting mysqld daemon with databases from /usr/local/mysql/var STOPPING server from pid file /usr/local/mysql/var/mail.centos.com.pid 100411 17:06:26 mysqld ended 是因为服务器没有取得mysql.pid文件,检查目录权限,通常再执行初始化数据库就可以了 |
# echo "/usr/local/mysql/bin/mysqld_safe " >> /etc/rc/local
测试一下
/usr/local/mysql/bin/mysqladmin version
2,安装 zlib
# tar zxvf zlib*
#cd zlib*
#./configure --prefix=/usr/local/zlib
#make
#make install
3,安装openssl
#tar xvzf openssl*
#cd openssl*
#./config shared zlib
#make
如果出现make[2]: *** [c_zlib.o] Error 1make[2]: Leaving directory `/usr/src/openssl-0.9.8l/crypto/comp'make[1]: *** [subdirs] Error 1make[1]: Leaving directory `/usr/src/openssl-0.9.8l/crypto'make: *** [build_crypto] Error 1 |
则是openssl-devel包没有,安装即可
#make test
#make install
#rm /usr/bin/openssl
#rm /usr/includes/openssl
#ln -sv /usr/local/ssl/bin/openssl /usr/bin/openssl
#ln -sv /usr/local/ssl/includes/opensll /usr/includes/openssl
#echo "/usr/local/ssl/lib" >> /etc/ld.so.conf
#ldconfig -v
4,安装httpd
#tar xvzf httpd*
#cd httpd*
#./configure --prefix=/usr/local/apache --sysconfdir=/etc/httpd --enable-so --enable-ssl
--with-ssl=/usr/local/ssl --enable-track-vars --enable-rewrite
--with-z-dir=/usr/local/zlib --enable-mods-shared=most
#make
#make install
#/usr/local/apache/bin/apachectl start
如果报错[root@mail httpd-2.2.14]# /usr/local/httpd/bin/apachectl starthttpd: Syntax error on line 82 of /etc/httpd.conf: Cannot load /usr/local/httpd/modules/mod_ssl.so into server: libssl.so.0.9.8: cannot open shared object file: No such file or directory |
ldconfig -v 即可
如果[root@mail httpd-2.2.14]# vi /httpd: apr_sockaddr_info_get() failed for mail.centos.comhttpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName 则是因为DNS解析不了主机名,可以再/etc/hosts文件添加对应 |
#echo "/usr/local/apache/bin/apachectl start" >> /etc/rc.local
5,安装libpng
#tar xvzf libpng*
#cd libpng*
#cp scripts/makefile.linux makefile
#make
#make install
6,安装freetype*
#tar xvzf freetype*
#cd freetype*
#mkdir -p /usr/local/freetype
#./configure --prefix=/usr/local/freetype
#make
#make install
7,安装jpegsrc.v6b
#tar xvzf jpegsrc.v6g
#cd jpegsrc.v6g
#./configure --prefix=/usr/local/jpeg6 --enable-shared --enable-static
#make
#mkdir -pv /usr/local/jpeg6 /usr/local/jpeg6/bin /usr/local/jpeg6/lib /usr/local/jpeg6/include /usr/local/jpeg6/man/man1
#make install
#make install-lib
8安装libxml2
#tar xvzf libxml2
#cd libxml2
#make -p /usr/local/libxml2
#./configure --prefix=/usr/local/libxml2
#make
#make install
#cp xml2-config /usr/bin
9安装GD库
#tar xvzf gd*
#cd gd
#./configure --prefix=/usr/local/gd2 --with-jpeg=/usr/local/jpeg6
--with-png=/usr/local/lib --with-zlib=/usr/local/zlib
--with-freetype=/usr/local/freetype
#make
#make install
10 安装php
#tar xzvf php
#cd php
#./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs
--with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config
--with-xml=/usr/local/libxml2
--with-png=/usr/local/lib --with-jpeg=/usr/local/jepg6 --with-zlib=/usr/local/zlib
--with-freetype=/usr/local/freetype --with-gd=/usr/local/gd2 --enable-track-vars
--enable-mbstring=all
#make
#make install
#cp php.ini-dist /usr/local/php/lib/php.ini
编辑/etc/httpd/httpd.conf
找到LoadModule php5_module modules/libphp5.so
添加AddType application/x-httpd-php .php
AddType application/x-httpd-source .phps
找到index.html 在前面加上index.php
vi /usr/local/apache/htdocs/index.php
<?
phpinfo();
?>
/usr/local/apache/bin/apactl restart
访问http://IP测试
11.安装ssl
# vi /usr/local/apache/conf/httpd.conf
查找 ssl的配置文件存放路径
Includes conf/extra/httpd-ssl.conf 并将注释去掉,使其开启
#vi /usr/local/apache/conf/extra/httpd-ssl.conf 编译ssl配置
查找证书文件的存放闻之
SSLCertificateFile "/usr/local/apache/conf/server.crt"
SSLCertificateKeyFile "/usr/local/apache/conf/server.key"
#cd /usr/local/apache/conf/
#openssl genrsa -out /usr/local/apache/conf/server.key 1024
#openssl req -new -x509 -key /usr/local/apache/conf/server.key -out /usr/local/apache/conf/server.crt
再重启httpd服务器就好了
相关阅读 更多 +