Linux下lamp源码安装

1.安装zlib压缩库

  • cd /root/data(放置目录)
  • tar -zxvf zlib-1.2.5.tar.gz(压缩包名)
  • cd zlib-1.2.5(进入解压缩之后的目录)
  • ./configure(有关配置)
    -make && make install(执行并安装)

2.安装apache(若有先卸载)
A.cd /root/data
B.tar -jxvf httpd-2.2.19.tar.bz2
C.cd httpd-2.2.19
D. ./configure –prefix=/usr/local/http2(指定软件的安装目录) –enable-modules=all(指定要加载的模块) –enable-mods-shared=all(表示模块以静态共享的方式安装)
–sysconfdir=/etc/httpd(指定软件的配置文件的存放位置)
–enable-so 加载so模块
E.修改apache配置文件 vim +148 /etc/httpd/httpd.conf 把#去掉
F.启动、停止、重启apache
/usr/local/http2/bin/apachectl start/stop/restart

3.安装libxm2
cd /root/data
tar -zxvf libxml2-2.7.2.tar.gz
cd libxml2-2.7.2
./configure –prefix=/usr/local/libxml2 –without-zlib(不需要zlib依赖)
make && make install

4.安装jpeg8
cd /root/data
tar -zxvf jpegsrc.v8b.tar.gz
cd jpeg-8b
./configure –prefix=/usr/local/jpeg –enable-shared –enable-static
make && make install

5.安装libpng
cd /root/data
tar -zxvf ….
cd …
./configure
make && make install

6.安装freetype(字体库)
cd /root/data
tar -zxvf freetype-2.4.1.tar.gz
cd freetype-2.4.1
./configure –prefix=/usr/local/freetype
make && make install

7.安装gd库
cd /root/data
tar -zxvf …
cd …
./configure –prefix=/usr/local/gd –with-jpeg(需要..扩展)=/usr/local/jpeg/ –with-png –with-zlib –with-freetype=/usr/local/freetype
make && make install

8.安装openssl(php一个扩展 支持加密 用于https协议)
cd …
tar –zxvf ..
cd ..
./config –prefix=/usr/local/openssl
make && make install

9.安装php
cd …
tar -ixvf.. .bz2
cd …
./configure –prefix=/usr/local/php –with-apxs2=/usr/local/http2/bin/apxs –with-mysql=mysqlnd –with-pdo-mysql=mysqlnd –with-mysqli=mysqlnd –with-freetype-dir=/usr/local/freetype –with-gd=/usr/local/gd –with-zlib –with-libxml-dir=/usr/local/libxml2 –with-jpeg-dir=/usr/local/jpeg –with-png-dir –enable-mbstring=all –enable-mbregex –enable-shared –with-openssl-dir=/usr/local/openssl –with-openssl
make && make install

复制php配置文件到指定目录
cp php.ini-development /usr/local/php/lib/php.ini

修改apache配置文件
添加apache的mine类型(大概 359)
vim +355 /etc/httpd/httpd.conf

在mine类型模块中添加()让apache支持解析php文件
AddType application/x-httpd-php .php

在dir modul模块添加默认文档声明(218行)
Directoryindex index.php index.html
重启apache
/usr/local/http2/bin/apachectl restart

创建php文件测试
位置: /usr/local/http2/htdocs

10.安装cmake(一款新的c语言编辑器,类似前面提及gcc,gcc-c++,mysql从5.5之后就不再使用别的编辑器,只能使用cmake)
cd ..
tar -zxvf
cd ….
./bootstrap
gmake && gmake install

11.安装ncurses-devel (mysql需要)
需要从光盘镜像中添加
光盘挂载 mount /dev/sr0 /mnt/dvd
rpm -ivh ….

12.安装Mysql
cd /root/data
tar -zxvf …gz
cd …
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/usr/local/mysql/data \ -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci
\表示换行继续输入的意思
make && make install
产生mysql配置文件
cp support-files/my-medium.cnf /etc/my.cnf

mysql用户组及权限设置:
useradd mysql
chmod a+x /usr/local/mysql
chown -R mysql.mysql /usr/local/mysql(设置所有者)
数据库初始化操作()本身没有默认数据 例如test数据库
/usr/local/mysql/scripts/mysql_install_db \
–user=mysql \
–basedir=/usr/local/mysql \
–datadir=/usr/local/mysql/data &
&符号表示所在命令在后台执行
卡屏回车

把mysql安装(除data)的所有者都改为root 避免数据库恢复为出厂设置
chown -R root /usr/local/mysql #将mysql安装目录递归改为root所有
chown -R mysql /usr/local/mysql/data #除了mysql/dta目录之外
后台运行mysql服务 /usr/local/mysql/bin/mysqld_safe –user=mysql &
查看mysql是否启动
Ps -a| grep mysql

测试数据库
/usr/local/mysql/bin/mysql -u root
默认没有密码
Use mysql;
update user set password=password(‘123456’) where user=’root’;
flush privileges; (刷新权限)

远程连接
use mysql;
select host,user,password from user;
update user set host=’%’ where user = ‘root’ limit 1;

tips:如果在安装某个软件出错,重新安装需要删除两个目录
第一:通过tar解压出来的目录
第二:使用–prefix指定的目录

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值