安装配置LAMP

真的很无奈啊,最近要在线上服务器配置LAMP的环境,因为开发的游戏只能在LAMP环境下才能正常的运行,哎。。。之前没有用研究过apache,也没有用过,无耐。。。。

没办法,只能应游戏要求,配置LAMP环境

配置如下:

软件版本:

httpd-2.2.16.tar.gz   mysql-5.1.40-linux-i686-icc-glibc23.tar.gz   php-5.3.27.tar.gz

  安装依赖包:

yum -y install patch make gcc gcc-c++ gcc-g77 flex bison file libtool libtool-libs autoconf kernel-devel libjpeg libjpeg-devel libpng libpng-devel libpng10 libpng10-devel gd gd-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glib2 glib2-devel bzip2 bzip2-devel libevent libevent-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel vim-minimal nano fonts-chinese gettext gettext-devel ncurses-devel gmp-devel pspell-devel unzip libcap pcre pcre-devel apr apr-devel

 安装mysql:

cd /usr/local/src/

wget http://syslab.comsenz.com/downloads/linux/mysql-5.1.40-linux-i686-icc-glibc23.tar.gz

tar -zxf mysql-5.1.40-linux-i686-icc-glibc23.tar.gz

mv mysql-5.1.40-linux-i686-icc-glibc23 /usr/local/mysql

useradd -s /sbin/nologin mysql

cd /usr/local/mysql

mkdir -p /data/mysql

chown -R mysql:mysql /data/mysql

/usr/local/mysql/scripts/mysql_install_db --user=mysql --datadir=/data/mysql  (看到两个OK即可)

cp support-files/my-large.cnf /usr/local/mysql/my.cnf

mv my.cnf my.cnf.old

vi my.cnf

[mysqld]

basedir=/usr/local/mysql

datadir=/data/mysql

socket=/tmp/mysql.sock

pid-file=/data/mysql/mysqld.pid

user=mysql

# Disabling symbolic-links is recommended to prevent assorted security risks

symbolic-links=0

innodb-file-per-table=1

innodb-open-file=500

innodb_log_file_size=512M

innodb_log_buffer_size=8M

innodb_buffer_pool_size=1G

max_allowed_packet=32M

max_connections=1000

log-bin=/data/binlog/mysql-binlog

[mysqld_safe]

log-error=/var/log/mysqld.log

mkdir -p /data/binlog/

chown -R mysql:mysql /data/binlog/

cp support-files/mysql.server  /etc/init.d/mysqld

chmod 755 /etc/init.d/mysqld

vi /etc/init.d/mysqld

找到datadir="/$basedir/data"改为datadir="/data/mysql"

chkconfig --add mysqld

chkconfig mysqld on

service mysqld start

[[email protected] mysql]# ps -ef | grep mysql

root      1401     1  0 10:17 pts/1    00:00:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/data/mysql --pid-file=/data/mysql/mysqld.pid

mysql     1522  1401  2 10:17 pts/1    00:00:00 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/data/mysql --user=mysql --log-error=/var/log/mysqld.log --pid-file=/data/mysql/mysqld.pid --socket=/tmp/mysql.sock

root      1540  1241  0 10:18 pts/1    00:00:00 grep mysql

echo "export PATH=$PATH:/usr/local/mysql/bin/" >> /etc/profile

source /etc/profile

  安装apache:

cd /usr/local/src/

wget http://syslab.comsenz.com/downloads/linux/httpd-2.2.16.tar.gz

tar -zxf httpd-2.2.16.tar.gz

cd httpd-2.2.16

./configure --prefix=/usr/local/apache2 --with-included-apr --enable-so --enable-deflate=shared --enable-expires=shared --enable-rewrite=shared --with-pcre

make

make install

echo "export PATH=$PATH:/usr/local/apache2/bin" >> /etc/profile

source /etc/profile

安装php:

先安装依赖库libmcrypt:

cd /usr/local/src/

wget ftp://mcrypt.hellug.gr/pub/crypto/mcrypt/libmcrypt/libmcrypt-2.5.7.tar.gz

tar -zxf libmcrypt-2.5.7.tar.gz

cd libmcrypt-2.5.7

./configure

make

make install

ldconfig

cd libltdl/

./configure --enable-ltdl-install

make

make install

vi /etc/ld.so.conf

添加:/usr/local/lib/

ldconfig

安装php:

cd /usr/local/src

wget http://am1.php.net/distributions/php-5.3.27.tar.gz

tar -zxf php-5.3.27.tar.gz

cd php-5.3.27

./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs --with-config-file-path=/usr/local/php/etc --with-gd --with-gettext --with-libxml-dir=/usr/local --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --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 --enable-bcmath --enable-mbstring --enable-sockets --disable-ipv6

make

make install

apachectl -M | grep php               (检查apache是否加载了php模块)

cp php.ini-production /usr/local/php/etc/php.ini

    apache结合php:

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

找到 AddType application/x-gzip .gz .tgz

在该行下面添加:AddType application/x-httpd-php .php

找到 DirectoryIndex index.html

将该行改为:DirectoryIndex index.html index.htm index.php

找到 #ServerName www.example.com:80

将注释去掉并改为:ServerName localhost:80

apachectl -t                         (检测配置文件是否正确)

apachectl start                      (启动httpd服务)

[[email protected] ~]# ps -ef | grep http

root      6881     1  0 11:24 ?        00:00:00 /usr/local/apache2/bin/httpd -k start

daemon    6882  6881  0 11:24 ?        00:00:00 /usr/local/apache2/bin/httpd -k start

daemon    6883  6881  0 11:24 ?        00:00:00 /usr/local/apache2/bin/httpd -k start

daemon    6884  6881  0 11:24 ?        00:00:00 /usr/local/apache2/bin/httpd -k start

daemon    6885  6881  0 11:24 ?        00:00:00 /usr/local/apache2/bin/httpd -k start

daemon    6886  6881  0 11:24 ?        00:00:00 /usr/local/apache2/bin/httpd -k start

root      6890  1241  0 11:25 pts/1    00:00:00 grep http

[[email protected] ~]# curl localhost

<html><body><h1>It works!</h1></body></html>         (只有显示这样才算正确)

    测试:

cd /usr/local/apache2/htdocs/

vi index.php

<?php

phpinfo();

?>

访问:192.168.186.131/index.php

时间: 2024-11-15 06:21:27

安装配置LAMP的相关文章

CentOS 7.0安装配置LAMP服务器(Apache+PHP+MariaDB)

原文 CentOS 7.0安装配置LAMP服务器(Apache+PHP+MariaDB) 一.配置防火墙,开启80端口.3306端口 CentOS 7.0默认使用的是firewall作为防火墙,这里改为iptables防火墙. 1.关闭firewall: systemctl stop firewalld.service #停止firewall systemctl disable firewalld.service #禁止firewall开机启动 2.安装iptables防火墙 yum insta

在CentOS6.4中安装配置LAMP环境的详细步骤

原文:在CentOS6.4中安装配置LAMP环境的详细步骤 本文详细介绍了CentOS6.4系统中安装LAMP服务并对其进行配置的过程,即安装Apache+PHP+Mysql,参照了网上大神的设置,其他Linux发行系统可以参考~ 在本文中部分命令操作需要root权限,输入‘su -’命令后输入密码即可切换root身份. 一.修改设置对安装做准备 1. 防火墙设置 设置/etc/sysconfig/iptables文件允许80端口和3306端口.因为80端口是http协议所使用的端口,如果防火墙

CentOS 7.0 安装配置LAMP服务器方法(Apache+PHP+MariaDB)

一.配置防火墙,开启80端口.3306端口 CentOS 7.0默认使用的是firewall作为防火墙,这里改为iptables防火墙. 1.关闭firewall: systemctl stop firewalld.service #停止firewall systemctl disable firewalld.service #禁止firewall开机启动 2.安装iptables防火墙 yum install iptables-services #安装 vi /etc/sysconfig/ip

CentOS 6.6安装配置LAMP服务器(Apache+PHP5+MySQL)

准备篇: CentOS 6.6系统安装配置图解教程 http://www.osyunwei.com/archives/8398.html 1.配置防火墙,开启80端口.3306端口 vi /etc/sysconfig/iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT -A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT

CentOS 6.3安装配置LAMP服务器(Linux+Apache+MySQL+PHP5)

服务器系统环境:CentOS 6.3 客户端系统环境:Windows 7 ultimate(x86)sp1 简体中文旗舰版 ※  本文档描述了如何在Linux服务器配置Apache.Mysql.PHP5 LAMP(Linux-Apache-MySQL-PHP)网站架构是目前国际流行的Web框架,该框架包括:Linux操作系统,Apache网络服务器,MySQL数据库,Perl.PHP或者Python编程语言,所有组成产品均是开源软件,是国际上成熟的架构框架,很多流行的商业应用都是采取这个架构,和

RPM 包格式安装配置LAMP

RPM包格式安装配置LAMP,提供两个虚拟主机,一个用于wordpress,一个用于phpMyAdmin,为后一个提供ssl访问方式.  一.首先用Yum 安装这几个软件:httpd, php, php-mysql, mysql-server 就可以了: # yum install -y php php-mysql mysql-server # service httpd start        安装好后就可以启动httpd服务了 创建2个虚拟主机的index.html 的主文件 # mkdi

转帖:CentOS 7 安装配置LAMP服务器方法(Apache+PHP+MariaDB)

准备篇: 一.配置防火墙,开启80端口.3306端口 CentOS 7 默认使用的是firewall作为防火墙,这里改为iptables防火墙. 1.关闭firewall: systemctl stop firewalld.service #停止firewall systemctl disable firewalld.service #禁止firewall开机启动 2.安装iptables防火墙 yum install iptables-services #安装 vi /etc/sysconfi

CentOS 6.4安装配置LAMP服务器

CentOS 6.4安装配置LAMP服务器 (Apache+PHP5+MySQL) 2013年03月12日 ? LAMP ? 评论数 10 ? 被围观 14,290次+ 准备篇: 1.配置防火墙,开启80端口.3306端口   vi /etc/sysconfig/iptables   -A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT   #允许80端口通过防火墙   -A INPUT -m state --state

阿里云服务器CentOS 5.7(64位)安装配置LAMP服务器(Apache+PHP5+MySQL)

阿里云服务器CentOS 5.7(64位)安装配置LAMP服务器(Apache+PHP5+MySQL) 转载自:http://elf8848.iteye.com/blog/1698351 一.快速安装Apache+PHP5+MySql ----------------------------------------------------- 补充:由于163的yum源上只有php5.1.6 mysql 5.0.95 版本较低,请直接看最后面的<八.卸载php5.1,mysql5.0 重新安装ph

转帖:CentOS 6安装配置LAMP服务器(Apache+PHP5+MySQL)

这篇文章主要介绍了CentOS 6 安装配置LAMP服务器(Apache+PHP5+MySQL)的方法,需要的朋友可以参考下 准备篇: 1.配置防火墙,开启80端口.3306端口vi /etc/sysconfig/iptables-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT #允许80端口通过防火墙-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -