电脑计算机论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 5421|回复: 0

Linux下配置LAMP安装discu,使用yum和源码安装两种方式

[复制链接]
admin 发表于 2018-3-6 16:40:16 | 显示全部楼层 |阅读模式
yum安装方式:

一键安装 LAMP方法:    yum  install httpd httpd-devel mysql-server mysql-devel php php-devel php-mysql -y  
   然后重启 apache 和 mysql:
/etc/init.d/httpd restart
/etc/init.d/mysqld restart 即可
netstat -ntl
/etc/init.d/iptables stop
chkconfig iptables off  永久关闭防火墙

安装discuz论坛
cd soft
wget http://download.com    discuz.zip
unzip discuz.zip -d /usr/local/apache/htdocs/
cd /usr/local/apache/htdocs/;
mv upload/* .  将 upload目录下的所有文件移动到当前目录
chmod 777 -R data/ uc_server/ config/ uc_client/

#mysql -uroot -p123456
create database discuz charset=utf8;
grant all on discuz.* to discuz$'localhost' identified by "123456";
然后打开 http://ip  开始安装discuz
源码安装方式:
安装apache
wget  http://   httpd-2.2.2.7
yum -y install apr-devel apr-util-devel

tar -xzf httpd-2.2.27.tar.gz  (如果是 .bz2格式 用  tar -jxf)

cd  httpd-2.2.27
./configure --prefix=/usr/local/apache2  预编译
make
make install

cd /usr/local/apache2
cd conf
vi httpd.conf
vi /usr/local/apache2/htdocs/index.html  默认首页

/usr/local/apache2/bin/apachectl start
安装mysql
cd /usr/src;
wget http://downloads.mysql.com/archi ... ysql-5.1.63.tar.gz;
tar xzf mysql-5.1.63.tar.gz;
cd mysql-5.1.63;
./configure --prefix=/usr/local/mysql --enable-assembles &&make &&make install

配置mysql服务为系统服务
cp /usr/local/mysql/share/mysql/my-mediu.cnf /etc/my.cnf
cp /usr/local/mysql/share/mysql.server /etc/rc.d/init.d/mysqld
chkconfig --add mysqld
chkconfig --level 345 mysqld on
cd /usr/local/mysql
useradd mysql
chown -R mysql.mysql /usr/local/mysql
/usr/local/mysql/bin/mysql_install_db --user=mysql
chown -R mysql var
/usr/local/mysqlbin/mysqld_safe --user=mysql &安装php
cd /usr/src
wget http://mirrors.sohu.com/php/php-5.3.28.tar.bz2;
tar jxf php-5.3.28.tar.bz2
cd php-5.3.28
./configure --prefix=/usr/local/php5 --with-config-file-path=/usr/local/php/etc --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr/local/mysql/
make
make install

配置php
  vi /usr/local/apache2/conf/httpd.conf
/  查找  LoadModul php5_module modules/libphp5.so(确认一下,其实默认已存在)
/查找确认没有 AddType application/x-httpd-php.php
         然后在  LoadModul 行的下面添加一行(其实添加到哪个位置都可以)

AddType application/x-httpd-php.php

然后/查找  Directoryindex 这是默认首页的顺序文件 添加上 index.php在最前面
然后在/usr/local/apache2/htdocs目录下创建index.php测试页面
cat >>/usr/local/apache2/htdocs/index.php<<EOF
<?php
phpinfo();
?>
EOF

启动mysql
/usr/local/mysql/bin/mysqld_safe --user=mysql&
启动apache
ps -ef | http  看看是否有apache启动,因为一个服务器上可能既安装了rpm格式的apache包,也安装了源码apache包,要用哪个要分清楚
rpm格式的apache启动方式   /etc/init.d/httpd start
我们这里用源码格式的apache
/usr/local/apache2/bin/apachectl start







您需要登录后才可以回帖 登录 | 注册

本版积分规则


QQ|手机版|小黑屋|电脑计算机论坛 ( 京ICP备2022023538号-1 )

GMT+8, 2024-11-23 20:33 , Processed in 0.090464 second(s), 20 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表