yum install lrzsz -y 在linux里可代替ftp上传和下载
rz 上传
sz + filename 下载
安装 apache2.4
1.1安装 apr
yum -y install epel-release
wget -c http://archive.apache.org/dist/apr/apr-1.5.2.tar.gz tar xf apr-1.5.2.tar.gz
cd apr-1.5.2 ./configure --prefix=/usr/local/apr;
echo $?
make && make install;
echo $?
1.2 安装 apr-util
wget -c http://archive.apache.org/dist/apr/apr-util-1.5.2.tar.gz
tar xf apr-util-1.5.2.tar.gz
cd apr-util-1.5.2
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr;
echo $?
make && make install;
echo $?
1.3 安装 httpd2.4.12
wget -c http://www.apache.org/dist/httpd/httpd-2.4.12.tar.gz
yes|yum install pcre-devel openssl-devel
tar xf httpd-2.4.12.tar.gz
[root@localhost ~]# cd httpd-2.4.12 [root@localhost httpd-2.4.12]# ./configure --prefix=/usr/local/apache --enable-so --enable-ssl --enable-cgi --enable-rewrite --with-zlib --with-pcre --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util/ --enable-modules=most --enable-mpms-shared=all --with-mpm=event;echo $? [root@localhost httpd-2.4.12]# make && make install;echo $?
源码安装LAMP之MySQL
2.1环境准备
yes | yum install gcc gcc-c++ make cmake ncurses-devel bison perl
groupadd mysql
useradd -r -g mysql mysql
mkdir /usr/local/mysql/ #创建mysql安装目录
mkdir /data/mysql #创建数据存放目录
chown mysql:mysql -R /data/mysql
2.2.2#开始安装
wget –c http://download.softagency.net/MySQL/Downloads/MySQL-5.5/mysql-5.5.44.tar.gz tar xf mysql-5.5.44.tar.gz
cd mysql-5.5.44
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_MEMORY_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DENABLED_LOCAL_INFILE=1 -DMYSQL_DATADIR=/data/mysql/ -DMYSQL_USER=mysql -DMYSQL_TCP_PORT=3306;
echo $?
make && make install ;echo $?
2.2.3、初始化MySQL
cp support-files/my-medium.cnf /etc/my.cnf #复制配置文件
cp support-files/mysql.server /etc/init.d/mysqld #复制启动脚本
chmod 755 /etc/init.d/mysqld
cd /usr/local/mysql #进入安装目录
chown -R mysql.mysql . # 授权
./scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql/ --datadir=/data/mysql #初始化数据库
/etc/init.d/mysqld start #启动数据库
2.2.4、MySQL配置
chkconfig --add mysqld #添加系统服务
chkconfig mysqld on #添加开机启动
export PATH=$PATH:/usr/local/mysql/bin #添加环境变量
echo 'PATH=$PATH:/usr/local/mysql/bin' >> /etc/profile
service mysqld start/stop
2.3 编译安装 PHP
2.3.1 安装 PHP 依赖包
wget -c http://au1.php.net/distributions/php-5.4.42.tar.bz2
yes|yum install libxml2-devel libmcrypt-devel bzip2-devel libxml2-devel openssl-devel bzip2 bzip2-devel
rpm -ivh "http://www.aminglinux.com/bbs/data/p_w_upload/forum/month_1211/epel-release-6-7.noarch.rpm"
yum install -y libmcrypt-devel
2.3.2 安装 PHP
tar xf php-5.4.42.tar.bz2
cd php-5.4.42
./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs --with-config-file-path=/usr/local/php/etc --with-mysql=/usr/local/mysql --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 --disable-ipv6 --with-pear --with-curl --with-openssl --with-mysqli --enable-mysqlnd --with-gettext --enable-bcmath --enable-sockets
make && make install ;echo $?
源码安装Apache+PHP整合
修改httpd.conf配置文件
vi /usr/local/apache/conf/httpd.conf
然后加入如下语句:
LoadModule php5_modulemodules/libphp5.so(默认已存在)
AddType application/x-httpd-php .php
DirectoryIndex index.php index.html (把index.php加入index.html之前)
然后在/usr/local/apache/htdocs目录下创建index.php测试页面,执行如下命令:
cat >>/usr/local/apache/htdocs/index.php <
phpinfo(); ?> EOF
重新启动apache服务,通过IP访问界面如下图,即代表LAMP环境搭建成功。