CentOS 6.7 编译安装LAMP
一、环境和软件包准备
使用163的yum源
cd /etc/yum.repos.d/wget
关闭防火墙和selinux
setenforce 0service iptables stop
需要准备的软件包

mkdir /tools; cd /tools
apr-1.5.2.tar.gz
apr-util-1.5.4.tar.gz
httpd-2.4.16.tar.gz
curl-7.45.0.tar.gz
gettext-0.19.5.tar
libmcrypt-2.5.7.tar.gz
mcrypt-2.6.8.tar.gz
lpng1618.zip
mod_fastcgi-2.4.6.tar.gz
MySQL-5.6.26.tar.gz
PHP-5.5.30.tar.gz
phpMyAdmin-4.5.0.2-all-languages.zip
libpng-1.2.53.tar
freetype-2.4.0.tar
jpegsrc.v9.tar
opencart-2.1.0.1.zip
zlib-1.2.3.tar
注.版本不一定要一样。
二、安装依赖环境
yum -y groupinstall”Development Libraries”yum -y groupinstall”Desktop Platform Development”yum -y groupinstall “X Software Development”yum -y install wget gcc gcc-c++ ncurses ncurses-devel cmakemake perl bison openssl openssl-devel gcc* libxml2 libxml2-devel curl-devellibjpeg* libpng* freetype* pcre-devel bzip2-devel libmcrypt-devel
三、编译安装apr1、编译安装apr
cd /toolstar xjvfapr-1.5.2.tar.bz2 -C /usr/src/;cd /usr/src/apr-1.5.2/./configure–prefix=/usr/local/aprmake && makeinstall
2、编译安装apr-util
cd /tools/tar xjvfapr-util-1.5.4.tar.bz2 -C /usr/src/;cd /usr/src/apr-util-1.5.4./configure–prefix=/usr/local/apr-util –with-apr=/usr/local/apr/make && make install
四、编译安装apache
cd /toolstar xjvf httpd-2.4.17.tar.bz2 -C /usr/src/;cd /usr/src/httpd-2.4.17./configure–prefix=/usr/local/apache2 –with-apr=/usr/local/apr–with-apr-util=/usr/local/apr-util/ –with-mpm=event –enable-so–enable-mods-shared=all –enable-proxy=shared –enable-proxy-balancer=shared–enable-prosy-http=shared –enable-proxy-ajp –enable-deflate –enable-cache–enable-disk-cache –enable-mem-cachemake && make install
五、编译安装mysql1、安装mysql
cd /toolstar xzvfmysql-5.6.26.tar.gz -C /usr/src/;cd /usr/src/mysql-5.6.26cmake-DENABLE_DOWNLOADS=1 -DCMAKE_INSTALL_PREFIX=/opt/mysql –with-mysql=mysqlnd –with-pdo-mysql=mysqlnd –with-mysqli=mysqlndmake&& make install2、创建相关设置mkdir/data/mysql/{mysql-data,mysql-logs} –pvgroupadd -r -g 306 mysqluseradd -r -g 306 -u 306mysqlchown -R mysql.mysql/data/mysql/
编辑配置文件
vim /etc/my.cnf
添加如下内容
[mysql]prompt= (\u@\h)[\d]>[client]port = 3306socket = /tmp/mysql3306.sockdefault_character_set = utf8[mysqld]user= mysqlport = 3306socket = /tmp/mysql3306.sockdatadir =/data/mysql/mysql-datapid_file = /data/mysql/mysql-data/mysql.pidlog-bin = /data/mysql/mysql-logs/mysql-binlog-error = /data/mysql/mysql-logs/mysql.err
编辑启动脚本
vim/etc/rc.d/init.d/mysqld
添加和修改如下三行
basedir=/opt/mysqldatadir=/data/mysql/mysql-datadefaultconf=/etc/my.cnf
设置启动脚本权限
chmod +x/etc/rc.d/init.d/mysqld
3、初始化数据库并启动初始化数据库,执行完成后如果看到有两个OK,说明初始化成功了。
/opt/mysql/scripts/mysql_install_db–user=mysql –datadir=/data/mysql/mysql-data/ –basedir=/opt/mysql/ –defaults-file=/etc/my.cnf
启动数据库
把mysql命令加入环境变量
使用service命令管理mysql进程
六、编译安装php1、安装curlcd /toolstar xzvf curl-7.45.0.tar.gz-C /usr/src/;cd /usr/src/curl-7.45.0./configure–prefix=/usr/local/curl && make && make install
2、安装libmcryptcd /toolstar xzvflibmcrypt-2.5.8.tar.gz -C /usr/src/;cd /usr/src/libmcrypt-2.5.8/./configure –prefix=/usr/local/libmcrypt && make&& make install
3、安装mhash
cd /toolstar xzvfmhash-0.9.9.9.tar.gz -C /usr/src/;cd /usr/src/mhash-0.9.9.9./configure–prefix=/usr/local/mhash && make && make installln -s /usr/local/lib/libmhash.a/usr/lib/libmhash.aln -s /usr/local/lib/libmhash.la/usr/lib/libmhash.laln -s /usr/local/lib/libmhash.so/usr/lib/libmhash.soln -s /usr/local/lib/libmhash.so.2/usr/lib/libmhash.so.2ln -s/usr/local/lib/libmhash.so.2.0.1 /usr/lib/libmhash.so.2.0.1echo “/usr/local/lib” >>/etc/ld.so.confldconfig
4、安装mcrypt
cd /toolstar xzvf mcrypt-2.6.8.tar.gz -C /usr/src/;cd/usr/src/mcrypt-2.6.8./configure –prefix=/usr/local/mcrypt –with-libmcrypt=/usr/local/libmcrypt/&& make && make install
5、安装gettext
cd /toolstar xvf gettext-0.19.5.tar-C /usr/src/;cd /usr/src/gettext-0.19.5./configure–prefix=/usr/local/gettext && make && make install
6、安装libxml2cd /toolstar xzvflibxml2-2.6.30.tar.gz -C /usr/src/;cd /usr/src/libxml2-2.6.30/./configure–prefix=/usr/local/libxml2 &&make && make install
7、安装phpcd /toolstarxzvf php-5.5.30.tar.gz -C /usr/src/;cd /usr/src/php-5.5.30./configure–prefix=/opt/php –with-apxs2=/usr/local/apache2/bin/apxs–with-curl=/usr/local/curl/ –with-mcrypt=/usr/local/mcrypt/–with-mysql=/opt/mysql/ –with-gettext=/usr/local/gettext/ –with-mysqli –with-bz2 –with-mhash–enable-sockets –enable-mbstring –enable-zip –enable-bcmath–enable-calendar –enable-exif –enable-ftp –enable-fpm –with-openssl–with-libxml-dir=/usr/local/libxml2/make&& make install
8、设置phpinfo和phpadmin(1)、设置phpinfo页面
cd/usr/local/apache2/htdocs/cat > index.php <
修改apache配置文件
vim /usr/local/apache2/conf/httpd.conf
在DirectoryIndex 后加上index.php,如下
DirectoryIndexindex.php index.html
在末尾加上
AddTypeapplication/x-httpd-php .php .phtmlAddType application/x-httpd-php-source.phps
访问
看到如下界面,说明lamp安装成功。
(2)、设置phpadmin
cd /toolsunzipphpMyAdmin-4.5.0.2-all-languages.zipmvphpMyAdmin-4.5.0.2-all-languages /usr/local/apache2/htdocs/phpadmincd/usr/local/apache2/htdocs/phpadmincpconfig.sample.inc.php config.inc.phpvim config.inc.php
修改如下内容,在$cfg[‘blowfish_secret’] 后面加上任意字符,给密码加密
把$cfg[‘Servers’][$i][‘host’]的localhost改成127.0.0.1
设置mysql密码
mysqladmin -u root password abc123mysqladmin -u root -h 127.0.0.1 passwordabc123
登陆mysql
mysql -u root -pabc123([emailprotected])[(none)]>grant allprivileges on *.* to root@’%’ identified by ‘root’;Query OK, 0 rows affected (0.00 sec)
用浏览器访问
看到如下界面,使用你的mysql用户名和密码登陆。
(3)、修改php.in到此LAMP基本安装完成,可通过调整php.ini实现一些自定义的功能。
cd /usr/src/php-5.5.30/cp php.ini-production /opt/php/lib/php.ini
七、扩展PHP模块有时候我们安装完成php后,发现有有需要的模块没有安装,但我们又不希望重新编译安装php,这时就可以使用动态扩展的方法安装php的扩展模块。
以下以GD模块和zlib模块为例子:
1、安装freetype
cd /toolstar xjvffreetype-2.4.0.tar.bz2 -C /usr/src/;cd /usr/src/freetype-2.4.0/./configure–prefix=/usr/local/freetype && make && make install
2、安装jpeg
cd /toolstar xzvf jpegsrc.v9.tar.gz-C /usr/src/;cd /usr/src/jpeg-9CFLAGS=”-O3-fPIC” ./configure –prefix=/usr/local/jpeg && make &&make installmkdir -p /usr/local/jpeg/includemkdir -p /usr/local/jpeg/libmkdir -p /usr/local/jpeg/binmkdir -p /usr/local/jpeg/man/man1
3、安装libpng
cd /toolstar xzvflibpng-1.2.53.tar.gz -C /usr/src/;cd /usr/src/libpng-1.2.53CFLAGS=”-O3-fPIC” ./configure –prefix=/usr/local/libpng && make &&make install
4、安装gd
./configure–with-php-config=/opt/php/bin/php-config –with-jpeg-dir=/usr/local/jpeg –with-png-dir=/usr/local/libpng –with-freetype-dir=/usr/local/freetype && make && makeinstall
5、安装zlib
6、编辑php.ini文件vim /opt/php/lib/php.ini
在末尾添加如下几行内容
extension_dir =/opt/php/lib/php/extensions/no-debug-zts-20121212/extension=gd.soextension=zlib.so
/opt/php/bin/php –m
重启httpd服务
/usr/local/apache2/bin/apachectlrestart
7、验证是否安装成功用浏览器访问phpinfo查看是否有了GD模块和zlib模块
Php GD模块和zlib模块安装完成。
八、搭建网站服务我们使用opencart这个开源项目作为WEB站点实验
cd /toolsunzip opencart-2.1.0.1.zip;cd opencart-2.1.0.1mv upload/ /usr/local/apache2/htdocs/opencart
浏览器访问
站点搭建完成。
九、设置防火墙
本文相关附件下载 :
具体下载目录在 /2015年资料/10月/27日/CentOS 6.7 编译安装LAMP/
下面关于的内容你可能也喜欢 :
画人物漫画的电脑工具是什么
photoshop是现在绘图最主要的工具~ 更专业点的还有pinter~只不过其稳定性较差~ 而就硬件而言~手写板是必不可少的~一个300多400多的手写板就能基本画出良好的漫画 倘若想要专业绘图~前期简单绘图或商业插画之类的用个900多块的手写板就好了~如果是画大幅的就要看手写板的分辨~基本好的要在2万左右就够用了~ 最后需要的最重要的一点就是你的美术基础跟天生的光感是否够强~大概就这些了!
液晶屏幕CCFL与LED主要有什么区别?
CCFL: Cold Cathode Fluorescent Lamp LED灯背光。 LED灯又称发光二极管,比起其它光源,单个LED灯的功耗是最小的。 CCFL背光。 此种背光的最大优点是亮度高,所以面积较大的黑白负相、蓝模负相和彩色液晶显示器件基本上都采用它。 理论上,它可以根据三基色的配色原理做出各种颜色。 其缺点是功耗较大,还需逆变电路驱动,而且工作温度较窄,为0~60度之间,而LED等其它的背光源都可达到-20~70之间。
【有没有谁能告诉我怎么在移动硬盘上装centOS,然后配置LAMP啊?】
主要的问题在于,你的引导分区信息没法写。 移动硬盘接上机器后,分区信息不是固定的。 除非你做成移动硬盘引导启动,就和光盘引导那样。
发表评论