码迷,mamicode.com
首页 > 其他好文 > 详细

2015-04-27LAMP第一部分-环境搭建

时间:2015-09-04 12:52:36      阅读:518      评论:0      收藏:0      [点我收藏+]

标签:blank   target   

自动安装

[学习笔记] LAMP 自动安装脚本

http://www.apelearn.com/bbs/forum.php?mod=viewthread&tid=7882&highlight=lamp%2B%2B%B0%B2%D7%B0

http://www.apelearn.com/bbs/thread-8119-1-1.html

手动安装

准备工作 

关闭 selinux

清空  iptables

1. 安装mysql
cd /usr/local/src/
wget http://mirrors.sohu.com/mysql/MySQL-5.1/mysql-5.1.72-linux-x86_64-glibc23.tar.gz
tar zxvf  mysql-5.1.72-linux-x86_64-glibc23.tar.gz
mv     mysql-5.1.72-linux-x86_64-glibc23  /usr/local/mysql
useradd -s /sbin/nologin mysql
cd /usr/local/mysql
mkdir -p /data/mysql
chown -R mysql:mysql /data/mysql

cd  /usr/local/mysql
./scripts/mysql_install_db --user=mysql --datadir=/data/mysql

(pwd  :/usr/local/mysql)

报错:http://www.plob.org/2011/03/10/78.html  安装 epel-release libmcrypt-devel  libaio pcre-devel perl libxml2-devel openssl-devel bzip2-devel freetype-devel libjpeg-devel libpng-devel compat-libstdc*

[root@wuhan-242 mysql]# ./scripts/mysql_install_db --user=mysql --datadir=/data/mysql 
WARNING: The host ‘wuhan-242‘ could not be looked up with resolveip.
This probably means that your libc libraries are not 100 % compatible
with this binary MySQL version. The MySQL daemon, mysqld, should work
normally with the exception that host name resolving will not work.
This means that you should use IP addresses instead of hostnames
when specifying MySQL privileges !
Installing MySQL system tables...
OK
Filling help tables...
OK

[root@centos-03 httpd-2.2.29]# echo  $?
0
cp support-files/my-large.cnf /etc/my.cnf
cp support-files/mysql.server /etc/init.d/mysqld
chmod 755 /etc/init.d/mysqld
vim /etc/init.d/mysqld  

#修改

basedir=/usr/local/mysql

datadir=/data/mysql

chkconfig --add mysqld
chkconfig mysqld on
/etc/init.d/mysqld start

Starting MySQL ERROR! Couldn‘t find MySQL manager (/usr/local/mysql/bin/mysqlmanager) or server (/usr/local/mysql/bin/mysqld_safe)
mv  时  文件移动不对
检查  mysqlmanager  所在的pwd
测试
netstat  -lnp |grep  3306
2. 安装apache
pwd  :  /usr/local/src/

wget   http://archive.apache.org/dist/httpd/httpd-2.2.16.tar.gz
tar zvxf httpd-2.2.16.tar.gz
cd httpd-2.2.29
./configure --prefix=/usr/local/apache2  --enable-mods-shared=most  --enable-so

[root@centos-03 httpd-2.2.29]# echo  $?
0

configure:error: in `/usr/local/src/httpd-2.2.21/srclib/apr‘:

configure:error: no acceptable C compiler found in $PATH

See `config.log‘for more details.

执行./configure时,可能会遇到以上错误,这个主要是gcc包没有安装。对于这个问题,使用 yum  install gcc就可以了。

make && make install

service  httpd  start

[root@localhost httpd-2.2.29]# service  httpd  start
httpd: 未被识别的服务

/usr/local/apache2/bin/apachectl start

http://blog.sina.com.cn/s/blog_5093fd500101bzk4.html

httpd: Could not reliably determine the server‘s fully qualified domain name, using 127.0.0.1 for ServerName

[  OK  ]

http://www.cnblogs.com/52linux/archive/2012/03/24/2415637.html

/etc/httpd/conf/httpd.conf 

/usr/local/apache2/conf/httpd.conf

将里面的 #ServerName localhost:80 注释去掉即可。

[root@sun httpd-2.2.29]# service  httpd  restart
Stopping httpd: [  OK  ]
Starting httpd: [  OK  ]

测试   浏览器 输入  111.47.123.72

技术分享

技术分享

ps  aux |grep  httpd

netstat  -lnp |grep  80
3.  安装php

pwd  :  /usr/local/src/

wget http://mirrors.sohu.com/php/php-5.3.29.tar.gz
tar zxf php-5.3.29.tar.gz
cd php-5.3.28
./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
echo  $?

1

configure: error: xml2-config not found. Please check your libxml2 installation.

configure: error: Cannot find OpenSSL‘s <evp.h>

configure: error: Please reinstall the BZip2 distribution

configure: error: jpeglib.h not found.

[root@sun php-5.3.28]# yum  install   -y   libxml2*

[root@sun php-5.3.28]# yum install -y  bzip2*

[root@sun php-5.3.28]# yum install -y  openssl-dev*

[root@sun php-5.3.28]# yum install -y  libmcrypt*

(yum install libxml2-devel  libjpeg-*  libpng-devel freetype-devel gd-devel libmcrypt-devel openssl-devel  bzip2*)

解决

yum install -y gcc gcc-c++  make zlib zlib-devel pcre pcre-devel  libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers

http://blog.csdn.net/default7/article/details/32312061
echo  $?
make && make install

/usr/bin/ld: cannot find -lltdl

collect2: ld returned 1 exit status

make: *** [libphp5.la] 错误 1
http://blog.sina.com.cn/s/blog_65d94e4c010195ys.html
Thank you for using PHP.
4. 配置apache结合php
vim /usr/local/apache2/conf/httpd.conf
找到:
AddType application/x-gzip .gz .tgz
在该行下面添加:
AddType application/x-httpd-php .php
找到:
<IfModule dir_module>
    DirectoryIndex index.html
</IfModule>
将该行改为:
<IfModule dir_module>
    DirectoryIndex index.html index.htm index.php
</IfModule>
找到:
#ServerName www.example.com:80
修改为:
ServerName localhost:80

[root@localhost htdocs]# /usr/local/apache2/bin/apachectl -t
Syntax OK
5. 测试解析php
vim /usr/local/apache2/htdocs/1.php
写入:
<?php
    echo "php解析正常";
?>
保存后,继续测试:
curl localhost/1.php

技术分享

[root@sun htdocs]# /usr/local/apache2/bin/apachectl restart
httpd not running, trying to start
(98)Address already in use: make_sock: could not bind to address [::]:80
(98)Address already in use: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
Unable to open logs
http://blog.sina.com.cn/s/blog_637e04c901011bmm.html

vi /etc/services   查看 端口号
扩展学习:
mysql5.5源码编译安装   http://www.aminglinux.com/bbs/thread-1059-1-1.html
mysql5.6源码安装报错  http://www.aminglinux.com/bbs/thread-7743-1-1.html
httpd-2.4版本编译安装方法  http://www.aminglinux.com/bbs/thread-7283-1-1.html
apache启动脚本加入系统服务列表  http://www.aminglinux.com/bbs/thread-7344-1-1.html
apache扩展模块安装  http://www.aminglinux.com/bbs/thread-848-1-1.html
如何指定使用worker/prefork  http://www.lishiming.net/thread-944-1-1.html
apache3种工作模式(默认2.2 为prefork, 2.4为event) http://www.cnblogs.com/fnng/archive/2012/11/20/2779977.html
apache的动态和静态  http://www.cnblogs.com/eoiioe/archive/2008/12/23/1360476.html(2.0和2.2一样)   http://blog.sina.com.cn/s/blog_6238358c01017gdu.html
php5.5、5.6编译安装方法 http://www.aminglinux.com/bbs/thread-7284-1-1.html
httpd.conf详解  http://www.php100.com/html/webkaifa/apache/2009/0418/1192.html
安装mysql时出错无法初始化缺少libstdc++.so.5  http://www.aminglinux.com/bbs/thread-6580-1-1.html

mysql初始化遇到的问题

http://www.apelearn.com/bbs/forum.php?mod=viewthread&tid=7993&highlight=mysql%2B%B3%F5%CA%BC%BB%AF

技术分享

[root@centos-03 support-files]# ps  -A|grep mysql
18144 ?        00:00:00 mysqld_safe
18246 ?        00:09:56 mysqld
[root@centos-03 support-files]# ps  -A|grep mysql
18144 ?        00:00:00 mysqld_safe
18246 ?        00:09:56 mysqld
[root@centos-03 support-files]# kill  -9  18144
[root@centos-03 support-files]# kill  -9  18246
[root@centos-03 support-files]# ps  -A|grep mysql
[root@centos-03 support-files]#  /etc/init.d/mysqld   start
Starting MySQL. SUCCESS! 
[root@centos-03 support-files]#

http://blog.csdn.net/red10057/article/details/7624538

[学习笔记] LAMP 自动安装脚本

http://www.apelearn.com/bbs/forum.php?mod=viewthread&tid=7882&highlight=lamp%2B%2B%B0%B2%D7%B0

No such file or directory
提示说没有该文件或者目录
你可以在/usr/local/mysql目录下 搜索看有没有mysql_install_db

2015-04-27LAMP第一部分-环境搭建

标签:blank   target   

原文地址:http://huawei306.blog.51cto.com/8535234/1691173

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!