Centos下安装Lamp和vsftpd、redis

Centos下安装Lamp和vsftpd、redis,第1张

概述[root@localhost~]#servcieiptablesstop--临时关闭防火墙[root@localhost~]#chkconfigiptablesoff--永久关闭防火墙yum安装httpd和php、mysql服务 1: yum search httpd            //搜索httpd开头的软件包2: yum install http

[root@localhost ~]#servcIE iptables stop --临时关闭防火墙

[root@localhost ~]#chkconfig iptables off --永久关闭防火墙

yum安装httpd和PHP、MysqL服务

 

1: yum search httpd            //搜索httpd开头的软件包2: yum install httpd.x86_64   //找到apache 对应的软件包名 Apache http Server,安装3: yum -y install MysqL-server MysqL PHP PHP-MysqL PHP-xml PHP-gd PHP-mbstring  //安装 MysqL  PHP 及其扩展4: service MysqLd restart  //启动MysqL    MysqL -uroot -p  空   show databases; 查看数据表5: iptables -F   //清空防火墙6: service iptables save  //保存防火墙规则7: service iptables stop  //关闭防火墙8: apachectl restart  //这时候会报错 9: vi /etc/httpd/conf/httpd.conf    //配置httpd10::set nu  //显示行号   11: :/Servername  //查找Servername12: :1  回到最顶行13: 去掉 Servername www.example.com:80   前面的#     保存 14: serveice httpd restart 重启 apache 15: 访问ip 查看apache启动情况16: cd /var/www/HTML   //进入PHP默认目录17: vi index.PHP    //创建PHP文件  保存 刷新查看信息18:service MysqLd start    启动MysqL

使用yum 安装apache(httpd) PHP MysqL

 

编译lamp安装方法

一:工具gcc安装

 

yum install gcc gcc-c++ kernel-devel

二:安装zlib

 

tar –zxvf zlib-1.2.5.tar.gz

cd zlib-1.2.5

./configure 

make && make install

三:安装apache

 

tar -jxvf httpd-2.2.19.tar.bz2

cd httpd-2.2.19

./configure --prefix=/usr/local/http2  \

--enable-modules=all \

--enable-mods-shared=all \

--enable-so

make && make install

编辑httpd.conf,把Servername ......80注释去掉

/usr/local/http2/bin/apachectl start  启动apache

四:准备安装PHP,需要安装PHP的一些依赖程序

 

A:安装libxml2

 

tar zxvf libxml2-2.7.2.tar.gz 

cd libxml2-2.7.2

./configure --prefix=/usr/local/libxml2    ///若是编译有问题,可以在configure 加上 --without-zlib 可以编译通过

make && make install

make 完正常情况显示

 

Making install in xstc

make[1]: Entering directory `/usr/local/src/libxml2-2.7.2/xstc'

make[2]: Entering directory `/usr/local/src/libxml2-2.7.2/xstc'

make[2]: nothing to be done for `install-exec-am'.

make[2]: nothing to be done for `install-data-am'.

make[2]: Leaving directory `/usr/local/src/libxml2-2.7.2/xstc'

make[1]: Leaving directory `/usr/local/src/libxml2-2.7.2/xstc'

B:安装jpeg8

 

tar -zxvf jpegsrc.v8b.tar.gz 

cd jpeg-8b 

./configure --prefix=/usr/local/jpeg \

--enable-shared --enable-static 

make && make install

C:安装libpng

 

tar zxvf libpng-1.4.3.tar.gz 

cd libpng-1.4.3 

./configure  安装到默认目录

make && make install

D:安装freetype(字体库)

 

tar zxvf freetype-2.4.1.tar.gz 

cd  freetype-2.4.1

./configure --prefix=/usr/local/freetype

make && make install

E:安装GD库

 

tar -zvxf gd-2.0.35.tar.gz 

mkdir -p /usr/local/gd 

cd gd-2.0.35 

./configure --prefix=/usr/local/gd  \

--with-jpeg=/usr/local/jpeg/  \

--with-png --with-zlib \

--with-freetype=/usr/local/freetype

make && make install

F:安装 PHP5

 

tar -jxvf PHP-5.3.6.tar.bz2

cd PHP-5.3.6

./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 

make && make install 

cp PHP.ini-development /usr/local/PHP/lib/PHP.ini

编辑apache配置文件,使其支持PHP解析

 

AddType application/x-httpd-PHP .PHP

LoadModule PHP5_module modules/libPHP5.so   //确保有

DirectoryIndex index.HTML在index.HTML 前面添加index.PHP 设置默认访问页面

五:安装MysqL

 

A:编译安装MysqL

 

tar -xzvf MysqL-5.1.58.tar.gz

cd MysqL-5.1.58

yum -y install ncurses-devel

./configure --prefix=/usr/local/MysqL \

--with-charset=utf8 \

--with-extra-charsets=gbk,gb2312,binary

make && make install

B:初始化MysqL

 

groupadd MysqL                     //创建一个组 叫 MysqL

useradd  -g MysqL MysqL         //创建一个用户叫MysqL,属于MysqL组  ,前面是组,后面是用户

cp support-files/my-medium.cnf /etc/my.cnf //复制配置文件

cd /usr/local/MysqL

chown -R MysqL.MysqL .            //给MysqL组赋权限

bin/MysqL_install_db --user=MysqL \            //创建MysqL系统数据库和测试数据库

--datadir=/usr/local/MysqL/var

chown -R root .                              //把当前目录文件的主人都改为root,避免数据库

 恢复出厂设置,就是避免上一条数据执行       

chown -R MysqL var                            //给数据库存放目录 var 赋予权限给MysqL用户,

只能 *** 作当前var目录

bin/MysqLd_safe --user=MysqL &

#[root@localhost init.d]# 170128 23:56:26 MysqLd_safe Logging to '/var/log/MysqLd.log'.

#170128 23:56:26 MysqLd_safe Starting MysqLd daemon with databases from /var/lib/MysqL

#170128 23:56:26 MysqLd_safe MysqLd from pID file /var/lib/MysqL/MysqLd.pID ended

# /usr/local/MysqL/bin/MysqL_install_db --user=MysqL  //此命令是出现以上报错解决方法

ps -A | grep MysqL   //查看MysqL是否启动

创建MysqL测试数据库和系统的数据库

 

把当前目录文件的主人都改为root,避免数据库恢复为出厂设置。

 

设置MysqL和apache、vsftpd服务自动启动

 

vim /etc/inittab   把ID:5:init....     把5改为3 ,让他走配置文件   设置服务器启动自动切换到命令行 

vim /etc/rc.d/rc.local   配置这个文件,加入下面的行命令

/usr/local/http2/bin/apachectl start

/usr/local/MysqL/bin/MysqLd_safe --user=MysqL &

/etc/rc.d/init.d/vsftpd  start  

service vsftpd start

下载redis

wget http://download.redis.io/releases/redis-2.6.16.tar.gz

tar zxvf redis-2.6.16.tar.gz

cd redis-2.6.16.tar.gz

make test

yum install tcl 

make test

make PREFIX=/usr/local/redis install

cp /usr/local/src/redis-2.6.16/redis.conf ./

./bin/redis-server ./redis.conf 

vim redis.conf    把daemonize  改为 yes ,设置自动启动   ,重启redis

安装PHP扩展编译

 

进入pecl.PHP.net

 

cd /usr/local/src

wget http://pecl.PHP.net/get/redis-2.2.4.tgz 

tar zxvf redis-2.2.4.tgz

cd redis-2.2.4.tgz

ls  发现没有configure

/usr/local/PHP/bin/PHPize

ls 发现出现configure

./configure --with-PHP-config=/usr/local/PHP/bin/PHP-config

make && make install ---------/usr/local/PHP/lib/PHP/extensions/no-deBUG-non-zts-20090626/     --复制扩展目录

引入编译出的redis.so

 

ls /usr/local/PHP/lib/PHP/extensions/no-deBUG-non-zts-20090626/  发现多出了一个redis.so

cd /usr/local/PHP/lib

vim PHP.ini

在 extension=PHP_shmop.dll 下面添加

 

extension =/usr/local/PHP/lib/PHP/extensions/no-deBUG-non-zts-20090626/redis.so

重启就可以了

总结

以上是内存溢出为你收集整理的Centos下安装Lamp和vsftpd、redis全部内容,希望文章能够帮你解决Centos下安装Lamp和vsftpd、redis所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/sjk/1167429.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-01
下一篇 2022-06-01

发表评论

登录后才能评论

评论列表(0条)

保存