1.freebsd9.1源码安装apache.mysql.php环境
2.centos5 源码安装Nginx + mysql + apache + php的方法
freebsd9.1源码安装apache.mysql.php环境
新手不建议用源码安装,请慎重1.安装9.1系统
2.通过Sysinstall安装预装软件
=========================================================
3.安装Linux_libio兼容包
rc.conf 增加一句linux_enable=true 应该是 linux_enable="YES"
========================================================
4.通过ports安装SSH守护进程(ports/security/sshgard)
5.通过Ports安装加密相关的软件(ports/security/mcrypt)
6.安装MYSQL
7.安装apr(/configure ,make install clean)
8.安装apr-util1.5.1(/configure --with-apr=/usr/local/apr)
9.安装Apache
. 安装PHP
.安装FastCGI
.安装Xcache
.安装Memcache
.安装Proftpd
Freebsd支持中文.txt
设置全局的 locale 参考下面方法:
vi /etc/login.conf
最后增加这个:
chinese:Chinese Users Accounts:/
:charset=UTF-8:/
:lang=zh_CN.UTF-8:/
:tc=default:
然后修改你的passwd文件,使用vipw命令
user:password:::language:0:0:User Name:/home/user:/bin/sh
language位置写入chinese,关联上你的thinkphp图片管理系统源码locale。
export LC_CTYPE="zh_CN.UTF-8"
export LC_ALL="zh_CN.UTF-8"
export LANG="zh_CN.UTF-8"
需要更新一下数据库,使用 cap_mkdb /etc/login.conf
登出再登录,使用命令 locale 就可以看到你的 locale 已经修改完成了
php需要环境.txt
1.curl,gd,mbstring,jpeg,png,php_memcache,xcache,mysql,apache
安装时都需要指定安装目录
Robin_预装包.txt
通过Sysinstall安装(光盘)
1.archives:libzip;zip;unzip
2.databases: sqlite
3.converters: libiconv(php用于编码转换)
4.devel: pre-8.l(Apache);perl-5..4.3
5.emulators: linux_base兼容包
6.FTP: curl-1..3.2
7.graphics: giflib-4.1.6 ; jpeg-8.3 ; libexif-0.6. ; png-1.4.8
8.lang: perl-5..4.3 ; python ; ruby
9.all: libxml2-7.8-1 , freetype
ports/emulators/linux_libauo
ports/security/sshguard
ports/security/mcrypt
kldstat 命令内核挂载情况,是否关在linux.ko
开始安装
1、安装mysql
创建用户组mysql
shellpw groupadd mysql
添加用户至用户组
shell pw useradd -r -g mysql mysql
解压:因为mysql是已经编译好的版本,因此无需安装
cd /soft
tar –vzxf mysql-5.6..tar.gz 解压
mv mysql-5.6.-free* /usr/local/servers/mysql
cd /usr/local/shadow/mysql
chown –R mysql . 更改当前文件夹下所有文件的用户(注意后面有.)
chgrp –R mysql . 更改当前文件夹下所有文件的组
./scripts/mysql_install_db –user=mysql 安装mysql服务,会生成一个my.cnf的erc1538源码分析配置文件
chown –R root . 修改mysql文件夹内所有文件用户为root
chown –R mysql data修改mysql文件夹内data文件夹用户为mysql
./bin/mysqld_safe –user=mysql 启动mysql服务
./bin/mysql –u root –p 密码为空
use mysql
Delete from user where host’.0.0.1’;
select host,user,password from user;
update user set host=’%’,password=password(‘shadow’); //修改登录ip为任意;密码为shadow
flush privileges; //刷新mysql帐号权限
然后远程连一下数据库试试吧。。
初始化root密码
bin/mysqladmin -u root password 'newpassword'
bin/mysqladmin –u root password
./mysqladmin -u root -p password ''
然后系统会询问你现在的密码,你输入现在的密码回车就可以了
下次使用MYSQL的时候,ROOT 的口令就是了
测试帐号
bin/mysql –u root –p
然后输入密码,出现提示符:
mysql
技巧提示:
mysql #运行mysql 客户端,好易用收银软件源码并开放root用户的远程访问权限。以便调试
use mysql
update user set host = '%' where user = 'root' and host 'localhost';
flush privileges;
quit
2、apache安装
Step 1
编译Apache的要求
1. 磁盘空间 2.ANSI- C编译器及编译环境 3.确保准确的时间 4.Perl5 [可选]
5. apr/apr-util = 1.2
需要先下载 apr-1.4.6.tar.gz 和 apr-util-1.5.1.tar.gz
配置并安装 地址 blogs.com/
3] mhash库
复制代码
代码如下:
tar zxvf mhash-0.9.9.9.tar.gz
cd mhash-0.9.9.9/
./configure
make
make install
cd ../
4]mcrypt库
注意:因为该库和libmcrypt有依赖性,所以在安装前必须知道libmcrypt,否则的话会出现:
错误
复制代码
代码如下:
checking for libmcrypt – version = 2.5.0…
*** ‘libmcrypt-config –version’ returned 2.4.0, but LIBMCRYPT (2.5.8)
*** was found! If libmcrypt-config was correct, then it is best
*** to remove the old version of LIBMCRYPT. You may also be able to fix the error
*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing
*** /etc/ld.so.conf. Make sure you have run ldconfig if that is
*** required on your system.
*** If libmcrypt-config was wrong, set the environment variable LIBMCRYPT_CONFIG
*** to point to the correct copy of libmcrypt-config, and remove the file config.cache
*** before re-running configure
configure: error: *** libmcrypt was not found
是因为path的问题,所以执行:
复制代码
代码如下:
ln -s /usr/local/lib/libmcrypt.la /usr/lib/libmcrypt.la
ln -s /usr/local/lib/libmcrypt.so /usr/lib/libmcrypt.so
ln -s /usr/local/lib/libmcrypt.so.4 /usr/lib/libmcrypt.so.4
ln -s /usr/local/lib/libmcrypt.so.4.4.8 /usr/lib/libmcrypt.so.4.4.8
ln -s /usr/local/lib/libmhash.a /usr/lib/libmhash.a
ln -s /usr/local/lib/libmhash.la /usr/lib/libmhash.la
ln -s /usr/local/lib/libmhash.so /usr/lib/libmhash.so
ln -s /usr/local/lib/libmhash.so.2 /usr/lib/libmhash.so.2
ln -s /usr/local/lib/libmhash.so.2.0.1 /usr/lib/libmhash.so.2.0.1
ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config
然后再安装:
复制代码
代码如下:
tar zxvf mcrypt-2.6.8.tar.gz
cd mcrypt-2.6.8/
/sbin/ldconfig
./configure
make
make install
cd ../
二、给源码加php后门安装mysql
复制代码
代码如下:
/usr/sbin/groupadd mysql
/usr/sbin/useradd -g mysql xxx
unzip mysql-5.1..zip
cd mysql-5.1./
./configure --prefix=/usr/local/webserver/mysql/ --enable-assembler --with-extra-charsets=complex --enable-thread-safe-client --with-big-tables
--with-readline --with-ssl --with-embedded-server --enable-local-infile --with-plugins=innobase
make
make install
make clean
make distclean
chmod +w /usr/local/webserver/mysql
chown -R xxx:mysql /usr/local/webserver/mysql
cp support-files/my-medium.cnf.sh /usr/local/webserver/mysql/my.cnf
cd ../
注意:这里编译./configure命令是一行的而不能有换行符,如果是copy的时候,注意要去处该换行符
在最后一步拷贝的时候,我安装完在support-files下没有my-medium.cnf而只有my-medium.cnf.sh所以将这个文件拷贝过去。
@张宴原文:
附:以下为附加步骤,共享洗车小程序源码如果你想在这台服务器上运行MySQL数据库,则执行以下两步。如果你只是希望让PHP支持MySQL扩展库,能够连接其他服务器上的MySQL数据库,那么,以下两步无需执行。
①、以xxx用户帐号的身份建立数据表:
复制代码
代码如下:
/usr/local/webserver/mysql/bin/mysql_install_db --basedir=/usr/local/webserver/mysql --datadir=/usr/local/webserver/mysql/data --user=xxx
②、启动MySQL(最后的表示在后台运行)
复制代码
代码如下:
/bin/sh /usr/local/webserver/mysql/bin/mysqld_safe --defaults-file=/usr/local/webserver/mysql/my.cnf
3、编译安装PHP(FastCGI模式)
复制代码
代码如下:
tar zxvf php-5.2.8.tar.gz
gzip -cd php-5.2.8-fpm-0.5..diff.gz | patch -d php-5.2.8 -p1
cd php-5.2.8/
./configure --prefix=/usr/local/webserver/php --with-config-file-path=/usr/local/webserver/php/etc --with-mysql=/usr/local/webserver/mysql
--with-mysqli=/usr/local/webserver/mysql/bin/mysql_config --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib
--with-libxml-dir=/usr --enable-xml --disable-rpath --enable-discard-path --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem
--enable-inline-optimization --with-curl --with-curlwrappers --enable-mbregex --enable-fastcgi --enable-fpm --enable-force-cgi-redirect
--enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-ldap
--with-ldap-sasl
make ZEND_EXTRA_LIBS='-liconv'
make install
cp php.ini-dist /usr/local/webserver/php/etc/php.ini
cd ../
注意:这里./configure命令是一行的而不能有换行符,如果是copy的时候,注意要去处该换行符
4、编译安装PHP5扩展模块--可选安装
复制代码
代码如下:
tar zxvf memcache-2.2.5.tgz
cd memcache-2.2.5/
/usr/local/webserver/php/bin/phpize
./configure --with-php-config=/usr/local/webserver/php/bin/php-config
make
make install
make clean
make distclean
cd ../
tar jxvf eaccelerator-0.9.5.3.tar.bz2
cd eaccelerator-0.9.5.3/
/usr/local/webserver/php/bin/phpize
./configure --enable-eaccelerator=shared --with-php-config=/usr/local/webserver/php/bin/php-config
make
make install
make clean
make distclean
cd ../
tar zxvf PDO_MYSQL-1.0.2.tgz
cd PDO_MYSQL-1.0.2/
/usr/local/webserver/php/bin/phpize
./configure --with-php-config=/usr/local/webserver/php/bin/php-config --with-pdo-mysql=/usr/local/webserver/mysql
make
make install
make clean
make distclean
cd ../
tar zxvf ImageMagick.tar.gz
cd ImageMagick-6.5.1-2/
./configure
make
make install
make clean
make distclean
cd ../
tar zxvf imagick-2.2.2.tgz
cd imagick-2.2.2/
/usr/local/webserver/php/bin/phpize
./configure --with-php-config=/usr/local/webserver/php/bin/php-config
make
make install
make clean
make distclean
cd ../
5、修改php.ini文件
STRONG手工修改:/STRONG查找/usr/local/webserver/php/etc/php.ini中的extension_dir = "./"
修改为extension_dir = "/usr/local/webserver/php/lib/php/extensions/no-debug-non-zts-/"
并在此行后增加以下几行,然后保存:
extension = "memcache.so"
extension = "pdo_mysql.so"
extension = "imagick.so"
再查找output_buffering = Off
修改为output_buffering = On
6、配置eAccelerator加速PHP:
mkdir -p /usr/local/webserver/eaccelerator_cache
vi /usr/local/webserver/php/etc/php.ini
按shift+g键跳到配置文件的最末尾,加上以下配置信息:
复制代码
代码如下:
[eaccelerator]
zend_extension="/usr/local/webserver/php/lib/php/extensions/no-debug-non-zts-/eaccelerator.so"
eaccelerator.shm_size=""
eaccelerator.cache_dir="/usr/local/webserver/eaccelerator_cache"
eaccelerator.enable="1"
eaccelerator.optimizer="1"
eaccelerator.check_mtime="1"
eaccelerator.debug="0"
eaccelerator.filter=""
eaccelerator.shm_max="0"
eaccelerator.shm_ttl=""
eaccelerator.shm_prune_period=""
eaccelerator.shm_only="0"
eaccelerator.compress="1"
eaccelerator.compress_level="9"
修改配置文件:
vi /etc/sysctl.conf
kernel.shmmax =
然后执行以下命令使配置生效:/sbin/sysctl -p
以下的步骤和张宴步骤中一样配置,不再赘诉