Lamp源码编译+SVN安装

[高]

一.LAMP安装所需要的源代码包列表
libxml http://www.xmlsoft.org/downloads.html
libmcrypt http://sourceforge.net/projects/mcrypt/files/Libmcrypt/
zlib http://www.zlib.net/
gd http://libgd.bitbucket.org/
autoconf http://www.gnu.org/software/autoconf/#downloading
freetype http://www.freetype.org/download.html
libpng http://www.libpng.org/pub/png/libpng.html
jpeg http://www.ijg.org/

httpd http://www.apache.org
mysql http://dev.mysql.com/downloads/
php http://www.php.net/download.php
zendOptimizer
phpmyadmin http://www.phpmyadmin.com

二.卸载默认的低版本环境
rpm -qa | grep -i httpd //查询系统中已安装的Apache相关软件包
service httpd stop //如果已开启,停止运行服务
rpm -e httpd-manual-2.0.40-21 --nodeps //卸载
rpm -e httpd-2.0.40-21 --nodeps
rpm -e .... --nodeps

同步的道理删除mysql和php其中php没有服务好停止的,如果有安装直接删除即可

三.安装扩展
1.libxml2
./configure --prefix=/usr/local/libxml2
make && make install

2.libmcrypt

1).
./configure --prefix=/usr/local/libmcrypt
make && make install

2).安装完成libmcrypt库以后,不同的Linux系统版本中可能还要安装一下libltdl库
cd libmcrypt/libltdl
./configure --enable-ltdl-install
make && make install

3.zlib
./configure --prefix=/usr/local/zlib
make && make install

4.libpng
./configure --prefix=/usr/local/libpng
make && make install

5.jpeg
mkdir /usr/local/jpeg6
mkdir /usr/local/jpeg6/bin
mkdir /usr/local/jpeg6/lib
mkdir /usr/local/jpeg6/include
mkdir -p /usr/local/jpeg6/man/man1

cd jpegsrc中
./configure --prefix=/usr/local/jpeg6
--enable-shared //建立共享库使用的GNU的libtool
--enable-static //建立静态库使用的GNU的libtool
make && make install


6. freetype
./configure --prefix=/usr/local/freetype
make && make install

7.autoconf
./configure
make && make install

8.gd库安装

① 链接头文件[可选操作]
ls –s /usr/local/libpng/include/pngconf.h /usr/inclu
ls –s /usr/local/libpng/include/png.h /usr/include


./configure --prefix=/usr/local/gd2
--with-zlib=/usr/local/zlib/ // 指定zlib库文件的位置
--with-jpeg=/usr/local/jpeg6/ //指定jpeg6库文件的位置
--with-png=/usr/local/libpng/ //指定png库文件的位置
--with-freetype=/usr/local/freetype/ //指定freetype字体库的位置
make && make install

四.安装LAMP

1.Apache
1).安装
./configure --prefix=/usr/local/apache2
--sysconfdir=/etc/httpd 指定apache服务器的配置文件存放位置,默认在安装路径的conf文件中,此项可选
--with-z=/usr/local/zlib/ zlib库文件位置
--with-included-apr 使用捆绑apr/apr-util的副本
--disable-userdir 请求的映象到用户特定目录
--enable-so 以动态共享对象(DSO)编译
--enable-deflate=shared 缩小传输编码的支持
--enable-expires=shared 期满头控制
--enable-rewrite=shared 基于规则的URL操控
--enable-static-support 建立一个静态链接版本的支持
make && make install

###################################

./configure --prefix=/usr/local/apache --sysconfdir=/usr/local/apache/conf
--enable-so --enable-ssl --with-ssl=/usr/local/ssl
--enable-track-vars --enable-rewrite --with-z-dir=/usr/local/zlib
--enable-mods-shared=most
--with-included-apr --with-apr=/usr/local/apr
--with-apr-util=/usr/local/apr-util/ --with-pcre=/usr/local/pcre

###################################

2).检查
/etc/httpd中有没有httpd.conf和extra子目录

3).启动
/usr/local/apache2/bin/apachectl start //启动apache
netstat -tnl | grep 80

4).浏览
打开浏览器输入 http://localhost 如出现 it work 表示apache服务器可以使用

5).制作成开机时自启动
echo "/usr/local/apache2/bin/apachectl start" >> /etc/rc.d/rc.local //完成了开机自启动

2.Mysql
1).为msyqld增加一个登陆用户和组
groupadd mysql
useradd -g mysql mysql

2).安装
./configure --prefix=/usr/local/mysql
--with-extra-charsets=all 在安装mysql时安装所有的字符集
make && make install

3).配置
cp support-files/my-medium.cnf /etc/my.cnf

#准备 mysql 配置文件
Vi /etc/my.cnf

[client]#修改客户端和连接字符集
default-character-set=utf8
[mysqld]
#修改服务器和数据库字符
character-set-server=utf8
# 修改服务器校验字符集
collation-server=utf8

4).创建mysql授权表
/usr/local/mysql/bin/mysql_install_db --user=mysql //创始授权表

5).权限的更改
chown -R root . //将文件的所有属性改为root用户
chown -R mysql var //将数据目录所用属性改为mysql用户
chgrp -R mysql . //将组属性改为mysql组
ls -l

6).启动
/usr/local/mysql/bin/mysqld_safe --user=mysql &
netstat -tul | grep 3306

7).使用mysqladmin验证服务器在运行中
/usr/local/mysql/bin/mysqladmin version

8).设置mysql密码
/usr/local/mysql/bin/mysql -uroot -p
进入后

删除匿名账户存在
delete from mysql.user where host='localhost' and user='';
flush privileges;

设置新密码
set password for 'root'@'localhost'=password('123456');

9).关闭mysql服务
/usr/local/mysql/bin/mysqladmin -u root -p shutdown //关闭数据库

10).开机自启动
在mysql源文件中
cp support-files/mysql.server /etc/rc.d/init.d/mysqld
修改文件/etc/rc.d/init.d/mysqld权限
chown root.root /etc/rc.d/init.d/mysqld
chmod 755 /etc/rc.d/init.d/mysqld

chkconfig -add mysqld
chkconfig --level 3 msyqld on
chkconfig --level 5 msyqld on
chkconfig --list mysqld

3.PHP
1). ./configure --prefix=/usr/local/php
--with-config-file-path=/usr/local/php/etc 指定PHP配置文件的路径
--with-apxs2=/usr/local/apache2/bin/apxs PHP查找apache2的地方
--with-mysql=/usr/local/mysql/ Mysql安装目录
--with-libxml-dir=/usr/local/libxml2/ libxml2位置
--with-png-dir=/usr/local/libpng/
--with-jpeg-dir=/usr/local/jpeg6/
--with-freetype-dir=/usr/local/freetype/
--with-gd=/usr/local/gd2/
--with-zlib-dir=/usr/local/zlib/
--with-mcrypt=/usr/local/libmcrypt/
--with-mysqli=/usr/local/mysql/bin/mysql_config 激活新增加的Mysqli功能
--enable-soap 激活SOAPT Web services支持
--enable-mbstring=all 使多字节字符串支持
--enable-sockets  变量激活socket通信特性
--with-openssl
--with-curl

make && make install

2).配置
在源码包中
cp php.ini-dist /usr/local/php/etc/php.ini

3).整合
vi /etc/httpd/httpd.conf

#添加这一条
Addtype application/x-httpd-php .php .phtml

修改为成后
/usr/local/apache2/bin/apachectl stop
/usr/local/apache2/bin/apachectl start


安装完毕

-----------------------------------------------------------------------------------------------------

[李]
cd /lamp/libxml2-2.6.30
./configure --prefix=/usr/local/libxml2/
make
make install

cd /lamp/libmcrypt-2.5.8
./configure --prefix=/usr/local/libmcrypt/
make
make install

cd /lamp/libmcrypt-2.5.8/libltdl
./configure --enable-ltdl-install
make
make install

cd /lamp/zlib-1.2.3
./configure
make
make install

cd /lamp/libpng-1.2.31
./configure --prefix=/usr/local/libpng/
make
make install

mkdir /usr/local/jpeg6
mkdir /usr/local/jpeg6/bin
mkdir /usr/local/jpeg6/lib
mkdir /usr/local/jpeg6/include
mkdir -p /usr/local/jpeg6/man/man1
cd /lamp/jpeg-6b
./configure --prefix=/usr/local/jpeg6/ --enable-shared --enable-static
make
make install

cd /lamp/freetype-2.3.5
./configure --prefix=/usr/local/freetype/
make
make install

cd /lamp/autoconf-2.61
./configure
make
make install

cd /lamp/gd-2.0.35
./configure --prefix=/usr/local/gd2/ --with-jpeg=/usr/local/jpeg6/ --with-freetype=/usr/local/freetype/
make
make install

cd /lamp/httpd-2.2.9
./configure --prefix=/usr/local/apache2/ --sysconfdir=/etc/httpd/ --with-included-apr --disable-userdir --enable-so --enable-deflate=shared --enable-expires=shared --enable-rewrite=shared --enable-static-support
make
make install

###################################

./configure --prefix=/usr/local/apache --sysconfdir=/usr/local/apache/conf
--enable-so --enable-ssl --with-ssl=/usr/local/ssl
--enable-track-vars --enable-rewrite --with-z-dir=/usr/local/zlib
--enable-mods-shared=most
--with-included-apr --with-apr=/usr/local/apr
--with-apr-util=/usr/local/apr-util/ --with-pcre=/usr/local/pcre

###################################



/usr/local/apache2/bin/apachectl start
echo "/usr/local/apache2/bin/apachectl start" >> /etc/rc.d/rc.sysinit

cd /lamp/ncurses-5.6
./configure --with-shared --without-debug --without-ada --enable-overwrite
make
make install

groupadd mysql
useradd -g mysql mysql
cd /lamp/mysql-5.0.41
./configure --prefix=/usr/local/mysql/ --with-extra-charsets=all
make
make install

cp support-files/my-medium.cnf /etc/my.cnf
/usr/local/mysql/bin/mysql_install_db --user=mysql
chown -R root /usr/local/mysql
chown -R mysql /usr/local/mysql/var
chgrp -R mysql /usr/local/mysql

/usr/local/mysql/bin/mysqld_safe --user=mysql &

cp /lamp/mysql-5.0.41/support-files/mysql.server /etc/rc.d/init.d/mysqld
chown root.root /etc/rc.d/init.d/mysqld
chmod 755 /etc/rc.d/init.d/mysqld
chkconfig --add mysqld
chkconfig --list mysqld
chkconfig --levels 245 mysqld off

cd /lamp/php-5.2.6
./configure --prefix=/usr/local/php/ --with-config-file-path=/usr/local/php/etc/ --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr/local/mysql/ --with-libxml-dir=/usr/local/libxml2/ --with-jpeg-dir=/usr/local/jpeg6/ --with-freetype-dir=/usr/local/freetype/ --with-gd=/usr/local/gd2/ --with-mcrypt=/usr/local/libmcrypt/ --with-mysqli=/usr/local/mysql/bin/mysql_config --enable-soap --enable-mbstring=all --enable-sockets
make
make install

cp php.ini-dist /usr/local/php/etc/php.ini
echo "Addtype application/x-httpd-php .php .phtml" >> /etc/httpd/httpd.conf
/usr/local/apache2/bin/apachectl restart

//--------------------------------------------------------------------------------------------------------------------------

最新版mysql源码安装cmake

1.准备
1).建立用户
useradd -s /sbin/nologin mysql
2).安装所需要的依赖包
yum install -y gcc* c++* autoconf automake zlib* libxml* ncurses-devel libmcrypt* libtool-ltdl-devel* bison
3).下载mysql源码包并解压
wget http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.15.tar.gz

4).安装
cmake -DMYSQL_USER=mysql -DCMAKE_INSTALL_PREFIX=/usr/local/mysql5.5 -DINSTALL_DATADIR=/data/mysql/data -DMYSQL_UNIX_ADDR=/tmp/mysqld.sock -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DEXTRA_CHARSETS=all -DWITH_EMBEDDED_SERVER=1 -DENABLED_LOCAL_INFILE=1 -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1

make && make install

5).配置

chown -R mysql.mysql /usr/local/mysql5.5/

cp 源码包/support-files/my-default.cnf /etc/my.cnf
cp 源码包/support-files/mysql.server /etc/init.d/mysqld
chkconfig --level 345 mysqld on
chkconfig --list mysqld

mkdir -p /data/mysql/data/log
vi /etc/my.cnf
basedir=/usr/local/mysql5.5
datadir=/data/mysql/data

/usr/local/mysql5.5/scripts/mysql_install_db --user=mysql --defaults-file=/etc/my.cnf --basedir=/usr/local/mysql5.5/ --datadir=/data/mysql/data

service mysqld start
netstat -tnl|grep 3306

修改密码:
/usr/local/mysql5.5/bin/mysqladmin -u root password 'root'

进入:
/usr/local/mysql5.5/bin/mysql -uroot -p

参数说明:
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql //安装目录
-DMYSQL_DATADIR=/usr/local/mysql/data //数据库存放目录
-DWITH_MYISAM_STORAGE_ENGINE=1 //安装 myisam 存储引擎
-DWITH_INNOBASE_STORAGE_ENGINE=1 //安装 innodb 存储引擎
-DWITH_ARCHIVE_STORAGE_ENGINE=1 //安装 archive 存储引擎
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 //安装 blackhole 存储引擎
-DENABLED_LOCAL_INFILE=1 //允许从本地导入数据
-DDEFAULT_CHARSET=utf8 //使用 utf8 字符
-DDEFAULT_COLLATION=utf8_general_ci //校验字符
-DEXTRA_CHARSETS=all //安装所有扩展字符集
-DMYSQL_TCP_PORT=3306 //MySQL 监听端口
-DMYSQL_USER=mysql //MySQL 用户名
其他参数:
-DWITH-EMBEDDED_SERVER=1 //编译成 embedded MySQL library (libm
-DSYSCONFDIR=/etc //MySQL 配辑文件
-DMYSQL_UNIX_ADDR=/tmp/mysqld.sock //Unix socket 文件路径
-DWITH_READLINE=1 //快捷键功能
-DWITH_SSL=yes //SSL
-DWITH_MEMORY_STORAGE_ENGINE=1 //安装 memory 存储引擎
-DWITH_FEDERATED_STORAGE_ENGINE=1 //安装 frderated 存储引擎
-DWITH_PARTITION_STORAGE_ENGINE=1 //安装数据库分区
-DINSTALL_PLUGINDIR=/usr/local/mysql/plugin //插件文件及配置路径

安装完毕

//-------------------------------------------------------------------------------------

SVN+Apache安装

一.安装依赖包

yum install subversion subversion-devel neon-devel

yum remove subversion 删除 subversion 只留 subversion 需要的环境


二.安装apache

./configure --prefix=/usr/local/apache
--with-included-apr
--with-apr=/usr/bin/apr-1-config
--with-apr-util=/usr/bin/apu-1-config
--enable-dav
--enable-maintainer-mode
--enable-proxy
--enable-so
--enable-rewrite
--with-mpm=worker

make && make install

三.安装 neon sqlite

tar xzvf neon-0.29.6.tar.gz
$ ./configure --prefix=/usr/local/neon --enable-shared
make&&make install

tar xzvf sqlite-amalgamation-3.7.3.tar.gz
$ ./configure --prefix=/usr/local/sqlite
make&&make install

四.安装SVN

tar xjvf subversion-1.6.15.tar.bz2
./configure --prefix=/usr/local/svn --with-apxs=/usr/local/apache/bin/apxs --with-apr=/usr/bin/apr-1-config --with-apr-util=/usr/bin/apu-1-config --with-sqlite=/usr/local/sqlite --with-neon=/usr/local/neon --with-ssl --enable-maintainer-mode --enable-shared

五.配置

创建 svn 数据文件
svnadmin create --pre-1.6-compatible /data/svn/demo
配置 apache 配置文件
<Location /svn>
DAV svn
SVNPath /data/svn/demo
AuthType Basic
AuthName "Demo"
AuthUserFile /data/svn/demo/conf/passwd
AuthzSVNAccessFile /data/svn/demo/conf/authz
Require valid-user
</Location>

/usr/local/apache/bin/htpasswd /data/svn/demo/conf/passwd cms 第一次创建用户
/usr/local/apache/bin/htpasswd -c /data/svn/demo/conf/passwd cms 以后创建用户

svn import svn file:///data/svn/demo/ -m "add utf" 加入数据到版本库
svn checkout http://192.168.1.200/svn/ 导出项目

附录:

开发人员常用命令
导入项目
svn import http://svn.chinasvn.com:82/pthread --message "Start project"
导出项目
svn checkout http://svn.chinasvn.com:82/pthread
采用 export 的方式来导出一份“干净”的项目
svn export http://svn.chinasvn.com:82/pthread pthread
为失败的事务清场
svn cleanup
在本地进行代码修改,检查修改状态
svn status -v
svn diff
更新(update)服务器数据到本地
svn update directory
svn update file
增加(add)本地数据到服务器
svn add file.c
svn add dir
对文件进行改名和删除
svn mv b.c bb.c
svn rm d.c
提交(commit)本地文档到服务器
svn commit
svn ci
svn ci -m "commit"
查看日志
svn log directory
svn log file

原文地址:https://www.cnblogs.com/ahwu/p/3450354.html