install

http://jingyan.baidu.com/article/19020a0ad09f35529d2842bf.html //vm10安装
http://60808.org/thread-17859-1-1.html //vm安装centos
http://www.helloswift.com.cn/swiftbase/2014/0608/3096.html //vm安装MAC OS X 10.9
http://lspgyy.blog.51cto.com/5264172/1275146 //克隆后网络不能上
http://www.linuxidc.com/Linux/2015-10/123845.htm //CentOS 6.5 生产环境编译安装LNMP
http://www.yimiju.com/articles/601.html //mysql5.7.9安装
http://blog.csdn.net/freshlover/article/details/9839867 //不从新编译PHP文件的状况下php GD库扩展库的编译安装(centos)
http://blog.csdn.net/zqtsx/article/details/9113261
http://www.linuxidc.com/Linux/2013-06/86188.htm
http://blog.chinaunix.net/uid-22312037-id-4089710.html //Nginx深刻详解之日志
http://kongzi68.blog.51cto.com/1432619/1629390 //cmake 错误解决
安装扩展
http://219.233.26.155/nchc.dl.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz
http://219.233.26.155/nchc.dl.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz
Libmcrypt(libmcrypt-2.5.8.tar.gz):http://sourceforge.net/project/showfiles.php?group_id=87941&package_id=91774&release_id=487459
http://m.oschina.net/blog/497350 //多版本php
http://www.ahlinux.com/php/14887.html //xdebug
http://www.we3ew.com/?p=1263 //fastcgi
http://www.lxway.com/99854061.htm //HttpRequest中常见的四种ContentType
https://www.zybuluo.com/phper/note/89081 //php-fpm的优化
1、环境准备
配置防火墙,开启80、3306端口
vim /etc/sysconfig/iptables
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT #容许80端口经过防火墙
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT #容许3306端口经过防火墙
特别提示:若是这两条规则添加到防火墙配置的最后一行,致使防火墙启动失败,正确的应该是添加到默认的22端口 。
/etc/init.d/iptables restart #最后重启防火墙使配置生效
四、关闭SELinux
vi /etc/selinux/configurations
#SELINUX=enforcing #注释掉
#SELINUXTYPE=targeted #注释掉
SELINUX=disabled #增长
:wq! #保存退出
setenforce 0 #使配置当即生效php


2、系统约定
硬盘分区:50G(/boot 200M /swap 8192M /)+100G(/mnt/soft/)
软件源代码包存放位置:/mnt/soft/local/src
源码包编译安装位置:/mnt/soft/local/软件名
数据库数据文件存储路径/mnt/soft/local/mysql/data/html


3、软件包下载
一、下载nginx(目前稳定版):http://nginx.org/download/nginx-1.9.9.tar.gz
二、下载pcre (支持nginx伪静态):ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre2-10.20.tar.gz
三、下载MySQL:http://cdn.mysql.com//Downloads/MySQL-5.7/mysql-5.7.9.tar.gz
四、下载php:http://cn2.php.net/distributions/php-5.6.17.tar.gz
五、下载cmake(MySQL编译工具):http://www.cmake.org/files/v3.4/cmake-3.4.1.tar.gz
六、下载libmcrypt(PHPlibmcrypt模块):http://nchc.dl.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz
七、下载GD库安装包(php页面图片验证码支持):https://github.com/libgd/libgd/releases/download/gd-2.1.0/libgd-2.1.0.tar.gz
将以上软件包上传到/mnt/soft/local/src/目录mysql


4、安装编译工具及库文件
使用CentOS yum命令一键安装
yum install -y make apr* autoconf automake curl curl-devel gcc gcc-c++ gtk-devel zlib-devel openssl openssl-devel \
pcre-devel gd kernel keyutils patch perl kernel-headers compat* cpp glibc libgomp libstdc++-devel keyutils-libs-devel \
libsepol-devel libselinux-devel krb5-devel libXpm* freetype freetype-devel freetype* fontconfig fontconfig-devel libjpeg* \
libpng* php-common php-gd gettext gettext-devel ncurses* libtool* libxml2 libxml2-devel patch policycoreutils bisonlinux


5、软件安装篇
一、安装cmake
cd /mnt/soft/local/src
tar zxvf cmake-3.4.1.tar.gz
cd cmake-3.4.1
./configure --prefix=/usr/local/cmake
make #编译
make install #安装
vim /etc/profile 在path路径中增长cmake执行文件路径
export PATH=$PATH:/usr/local/cmake/bin
source /etc/profile使配置当即生效
二、安装pcre
cd /mnt/soft/local/src
mkdir /usr/local/pcre #建立安装目录
tar zxvf pcre2-10.20.tar.gz
cd pcre2-10.20
./configure --prefix=/usr/local/pcre #配置
make && make install
三、安装libmcrypt
cd /mnt/soft/local/src
tar zxvf libmcrypt-2.5.8.tar.gz #解压
cd libmcrypt-2.5.8 #进入目录
./configure #配置
make #编译
make install #安装
四、安装gd库
cd /mnt/soft/local/src
tar zxvf gd-2.0.36RC1.tar.gz
cd gd-2.0.36RC1
./configure --enable-m4_pattern_allow —prefix=/mnt/soft/local/gd --with-jpeg=/usr/lib --with-png=/usr/lib --with-xpm=/usr/lib --with-freetype=/usr/lib --with-fontconfig=/usr/lib #配置
make #编译
make install #安装
5.安装mysql
新增mysql用户组
# groupadd mysql
新增mysql用户
# useradd -r -g mysql mysql
新建数据库执行文件目录(后面会把编译好的mysql程序安装到这个目录)
# mkdir -p /usr/local/mysql
新建文件目录
# mkdir -p /home/mysql
#
# mkdir -p /home/mysql/logs
# mkdir -p /home/mysql/temp
注意:上面的第3及第4是为了之后将MySQL的数据文件与执行程序文件分离,若是你打算设置到不一样的路径,注意修改对应的执行命令和数据库初始化脚本!
编辑PATH搜索路径
# vi /etc/profile +
# 在profile文件末尾增长两行
PATH=/usr/local/mysql/bin:/usr/local/mysql/lib:$PATH
export PATH
使PATH搜索路径当即生效:
# source /etc/profilenginx

tar -zxvf mysql-5.7.9.tar.gz
cd mysql-5.7.9laravel

检查是否找获得boost类库,没有就安装
#################boost类库####################
//5.7须要boost类库,可以使用 -DDOWNLOAD_BOOST=1 -DWITH_BOOST=<directory> 参数将在指定路径查找,如未找到会指定下载并解压到指定的路径
http://219.233.31.120/ncu.dl.sourceforge.net/project/boost/boost/1.59.0/boost_1_59_0.tar.gz
tar zxvf boost_1_59_0
###############################################c++

须要注意CentOS 6.4版操做系统的最小安装完成后,即便没有安装mysql,在/etc目录下也会存在一个my.cnf文件,建议将此文件改名为其余的名字,不然该文件会干扰源码安装的MySQL的正确配置,形成没法启动。修改/etc/my.cnf操做以下:
# mv /etc/my.cnf /etc/my.cnf.bak
# 固然也能够删除掉/etc/my.cnf这个文件:
# rm /etc/my.cnfgit


使用cmake源码安装mysql(若是你打算安装到不一样的路径,注意修改下面语句中/usr/local/mysql这个路径!)
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_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_MEMORY_STORAGE_ENGINE=1 \
-DWITH_READLINE=1 \
-DENABLED_LOCAL_INFILE=1 \
-DMYSQL_DATADIR=/home/mysql/data \
-DMYSQL_USER=mysql \
-DMYSQL_TCP_PORT=3306 \
-DWITH_BOOST=/mnt/soft/local/src/boost_1_59_0github

 

上面的这些复制完,回车,而后就开始cmake的过程,通常时间不会很长。
cmake结束后开始编译源码,这一步时间会较长,请耐心等待。
# make
安装编译好的程序
# make install
注意:若是须要重装mysql,在/usr/local/src/mysql-5.7.9在执行下make install就能够了,不须要再cmake和make
清除安装临时文件
# make clean
修改目录拥有者
# chown -Rf mysql:mysql /usr/local/mysql
# chown -Rf mysql:mysql /home/mysql
进入mysql执行程序的安装路径
# cd /usr/local/mysql
执行初始化配置脚本,建立系统自带的数据库和表(注意路径/home/mysql/data须要换成你自定定义的数据库存放路径)
# bin/mysqld --initialize --user=mysql --basedir=/home/mysql --datadir=/home/mysql/data
A temporary password is generated for root@localhost: Q7tlTDeoWu>&
#初始化脚本在/usr/local/mysql/support-files下生成了配置文件my.cnf,须要更改该配置文件的全部者:web


# chown -Rf mysql:mysql /usr/local/mysql
注意:
(1)Tips:在启动MySQL服务时,会按照必定次序搜索my.cnf,先在/etc目录下找,找不到则会搜索mysql程序目录下是否有my.cnf";
(2)须要注意CentOS 6.4版操做系统的最小安装完成后,即便没有安装mysql,在/etc目录下也会存在一个my.cnf文件,建议将此文件改名为其余的名字,不然该文件会干扰源码安装的MySQL的正确配置,形成没法启动。修改/etc/my.cnf操做以下:
# mv /etc/my.cnf /etc/my.cnf.bak
# 固然也能够删除掉/etc/my.cnf这个文件:
# rm /etc/my.cnf
(3)若是你须要用于生产环境,不要急着作下面的mysql启动操做。建议把上一步骤中mysql初始化生成的/usr/local/mysql/mysql.cnf删除,而后把你优化好的mysql配置文件my.cnf放到/etc下。(这是我作mysql主从复制和mysql优化的经验!)
复制服务启动脚本
# cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql
启动MySQL服务
# service mysql start
设置开机自动启动服务
# chkconfig mysql on

ps aux |grep mysq* //查看mysql进程


检测下上一步MySQL用户root密码是否生效:
[root@yimiju etc]# mysql -u root
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)——没有密码没法登陆,说明密码修改为功了。

###若是不行 就mysqld_safe --user=mysql --skip-grant-tables --skip-networking & mysql -u root mysql

[root@yimiju ~]# mysql -u root -p
Enter password: ——这里提示时输入你设置的mysql root账号密码
#登陆成功有以下提示:
Welcome to the MySQL monitor. Commands end with ; or \g.......

方式1
bin/mysqladmin -u root -p password 设置密码


方式2登陆并修改MySQL用户root的密码
# mysql -u root
mysql> use mysql;
mysql> GRANT ALL PRIVILEGES ON *.* TO root@"%" IDENTIFIED BY "123456";
mysql> update user set Password = password('123456') where User='root';
mysql> flush privileges;
mysql> exit;


***常见错误

1.pid错误 关闭进程

ps aux | grep mysq* //查看mysql进程
kill -9 进程id

2.ERROR! MySQL is not running, but lock file (/var/lock/subsys/mysql) exists
rm -rf /var/lock/subsys/mysql //删除便可


(可选)运行安全设置脚本,强烈建议生产服务器使用:
[root@yimiju ~]# /usr/local/mysql/bin/mysql_secure_installation
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
In order to log into MySQL to secure it, we'll need the current
password for the root user. If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.
Enter current password for root (enter for none):
OK, successfully used password, moving on...
Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.
You already have a root password set, so you can safely answer 'n'.
Change the root password? [Y/n] n ---------------这里输入n
... skipping.
By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.
Remove anonymous users? [Y/n] Y ---------------这里输入Y
... Success!
Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] n ---------------这里输入n
... skipping.
By default, MySQL comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n] Y ---------------这里输入Y
- Dropping test database...
ERROR 1008 (HY000) at line 1: Can't drop database 'test'; database doesn't exist
... Failed! Not critical, keep moving...
- Removing privileges on test database...
... Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] Y ---------------这里输入Y
... Success!
All done! If you've completed all of the above steps, your MySQL
installation should now be secure.
Thanks for using MySQL!
Cleaning up...
重启服务器,检测mysql是否能开机自动启动
[root@yimiju ~]# reboot

6.安装nginx

cd /usr/local/src
groupadd www #添加www组
useradd -g www www -s /bin/false #建立nginx运行帐户www并加入到www组,不容许www用户直接登陆系统
tar zxvf nginx-1.4.4.tar.gz
cd nginx-1.4.4
./configure --prefix=/usr/local/nginx --without-http_memcached_module --user=www --group=www --with-http_stub_status_module --with-openssl=/usr/ --with-pcre=/mnt/soft/local/src/pcre-8.37
注意:--with-pcre=/mnt/soft/local/src/pcre2-10.20指向的是源码包解压的路径,而不是安装的路径,不然会报错
make
make install
/usr/local/nginx/sbin/nginx #启动nginx
设置nginx开启启动
vi /etc/rc.d/init.d/nginx #编辑启动文件添加下面内容
=======================================================
#!/bin/bash
# nginx Startup script for the Nginx HTTP Server
# it is v.0.0.2 version.
# chkconfig: - 85 15
# description: Nginx is a high-performance web and proxy server.
# It has a lot of features, but it's not for everyone.
# processname: nginx
# pidfile: /var/run/nginx.pid
# config: /usr/local/nginx/conf/nginx.conf
nginxd=/usr/local/nginx/sbin/nginx
nginx_config=/usr/local/nginx/conf/nginx.conf
nginx_pid=/usr/local/nginx/logs/nginx.pid
RETVAL=0
prog="nginx"
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0
[ -x $nginxd ] || exit 0
# Start nginx daemons functions.
start() {
if [ -e $nginx_pid ];then
echo "nginx already running...."
exit 1
fi
echo -n $"Starting $prog: "
daemon $nginxd -c ${nginx_config}
RETVAL=$?
echo
[ $RETVAL = 0 ] && touch /var/lock/subsys/nginx
return $RETVAL
}
# Stop nginx daemons functions.
stop() {
echo -n $"Stopping $prog: "
killproc $nginxd
RETVAL=$?
echo
[ $RETVAL = 0 ] && rm -f /var/lock/subsys/nginx /usr/local/nginx/logs/nginx.pid
}
reload() {
echo -n $"Reloading $prog: "
#kill -HUP `cat ${nginx_pid}`
killproc $nginxd -HUP
RETVAL=$?
echo
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
reload)
reload
;;
restart)
stop
start
;;
status)
status $prog
RETVAL=$?
;;
*)
echo $"Usage: $prog {start|stop|restart|reload|status|help}"
exit 1
esac
exit $RETVAL
=======================================================
:wq! #保存退出
chmod 775 /etc/rc.d/init.d/nginx #赋予文件执行权限
chkconfig nginx on #设置开机启动
/etc/rc.d/init.d/nginx restart #从新启动Nginx
service nginx restart
=======================================================


七、安装php
cd /usr/local/src
tar -zvxf php-5.5.7.tar.gz
cd php-5.5.7.
./configure --prefix=/usr/local/php5 --with-config-file-path=/usr/local/php5/etc --with-mysql=/usr/local/mysql --with-mysql-sock=/tmp/mysql.sock --with-iconv --with-zlib --enable-xml --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-usrimization --enable-mbregex --enable-fpm --enable-mbstring --enable-ftp --with-openssl --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --without-pear --with-gettext --enable-session --with-mcrypt --with-curl --with-jpeg-dir --with-freetype-dir

make #编译
make install #安装
cp php.ini-production /usr/local/php5/etc/php.ini #复制php配置文件到安装目录
rm -rf /etc/php.ini #删除系统自带配置文件
ln -s /usr/local/php5/etc/php.ini /etc/php.ini #添加软连接
cp /usr/local/php5/etc/php-fpm.conf.default /usr/local/php5/etc/php-fpm.conf #拷贝模板文件为php-fpm配置文件
vi /usr/local/php5/etc/php-fpm.conf #编辑
user = www #设置php-fpm运行帐号为www
group = www #设置php-fpm运行组为www
pid = run/php-fpm.pid #取消前面的分号
设置 php-fpm开机启动
cp /usr/local/src/php-5.5.7/sapi/fpm/init.d.php-fpm /etc/rc.d/init.d/php-fpm #拷贝php-fpm到启动目录
chmod +x /etc/rc.d/init.d/php-fpm #添加执行权限
chkconfig php-fpm on #设置开机启动
vi /usr/local/php5/etc/php.ini #编辑配置文件
找到:disable_functions =
修改成:disable_functions = passthru,exec,system,chroot,scandir,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,escapeshellcmd,dll,popen,disk_free_space,checkdnsrr,checkdnsrr,getservbyname,getservbyport,disk_total_space,posix_ctermid,posix_get_last_error,posix_getcwd, posix_getegid,posix_geteuid,posix_getgid, posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid, posix_getppid,posix_getpwnam,posix_getpwuid, posix_getrlimit, posix_getsid,posix_getuid,posix_isatty, posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid, posix_setpgid,posix_setsid,posix_setuid,posix_strerror,posix_times,posix_ttyname,posix_uname
#列出PHP能够禁用的函数,若是某些程序须要用到这个函数,能够删除,取消禁用
找到:;date.timezone =
修改成:date.timezone = PRC #设置时区
找到:expose_php = On
修改成:expose_php = OFF #禁止显示php版本的信息
找到:short_open_tag = Off
修改成:short_open_tag = ON #支持php短标签

#php配置进入环境变量
vi /etc/profile 在path路径中增长php执行文件路径
export PATH=$PATH:/usr/local/php5/bin
source /etc/profile使配置当即生效

http://www.cnblogs.com/codebean/archive/2011/05/30/php-cli-argv.html //PHP命令行模式的相关参数详解

5、配置nginx支持php
vi /usr/local/nginx/conf/nginx.conf
修改/usr/local/nginx/conf/nginx.conf 配置文件,需作以下修改
user www www; #首行user去掉注释,修改Nginx运行组为www www;必须与/usr/local/php/etc/php-fpm.conf中的user,group配置相同,不然php运行出错
user www www;
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
server_name localhost;
root /data1/www ;
index index.html index.php;
#charset koi8-r;

#access_log logs/host.access.log main;

#location / {
# root html;
# index index.html index.htm;
#}

#error_page 404 /404.html;

# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}

# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}

# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
}
/etc/init.d/nginx restart #重启nginx

6、测试篇
cd /usr/local/nginx/html/ #进入nginx默认网站根目录
rm -rf /usr/local/nginx/html/* #删除默认测试页
vi index.php #新建index.php文件
phpinfo();
?>
:wq! #保存退出
chown www.www /usr/local/nginx/html/ -R #设置目录全部者
chmod 700 /usr/local/nginx/html/ -R #设置目录权限

7、其它说明
服务器相关操做命令
service nginx restart #重启nginx
service mysqld restart #重启mysql
/usr/local/php/sbin/php-fpm #启动php-fpm
/etc/rc.d/init.d/php-fpm restart #重启php-fpm
/etc/rc.d/init.d/php-fpm stop #中止php-fpm
/etc/rc.d/init.d/php-fpm start #启动php-fpm
nginx默认站点目录是:/usr/local/nginx/html/
权限设置:chown www.www /usr/local/nginx/html/ -R
MySQL数据库目录是:/usr/local/mysql/var
权限设置:chown mysql.mysql -R /usr/local/mysql/var

8、安全优化
sherwin@rocnic~$ssh root@172.16.134.141
root@172.16.134.141's password:
Last login: Sat Jan 18 12:11:57 2014 from 172.16.134.1
-bash: warning: setlocale: LC_CTYPE: cannot change locale (UTF-8): No such file or directory
[root@dev01 ~]# locale
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
LANG=en_US.UTF-8
LC_CTYPE=UTF-8
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=


九。不从新编译PHP文件的状况下php GD库扩展库的编译安装(centos)
####################(注意若是服务器没有libjpeg等 就去)#################
安装 zlib
wget ftp://ftp.sunfreeware.com/pub/freeware/SOURCES/zlib-1.2.3.tar.gz
tar -zxf zlib-1.2.3.tar.gz
cd zlib-1.2.3
./configure --prefix=/usr/local/zlib
make
make install

安装 jpeg
wget ftp://ftp.sunfreeware.com/pub/freeware/SOURCES/jpeg.tar.gz
安装前先建立jpeg安装文件所需(以下)目录,防止提示相似“没法建立通常文件‘/usr/local/jpeg/***’: 没有那个文件或目录" 的错误
mkdir /usr/local/jpeg
mkdir /usr/local/jpeg/bin
mkdir /usr/local/jpeg/lib
mkdir /usr/local/jpeg/include
mkdir /usr/local/jpeg/man
mkdir /usr/local/jpeg/man1
mkdir /usr/local/jpeg/man/man1
tar -zxf jpeg.tar.gz
cd jpeg-6b
./configure --prefix=/usr/local/jpeg --enable-shared --enable-static
make
make install

安装完成提示:
Libraries have been installed in:
/usr/local/jpeg6/lib

安装 libpng

wget ftp://ftp.sunfreeware.com/pub/freeware/SOURCES/libpng-1.2.16.tar.gz
tar -zxf libpng-1.2.16.tar.gz
cd libpng-1.2.16
./configure --prefix=/usr/local/libpng
make
make install

安装 freetype
wget http://download.savannah.nongnu.org/releases/freetype/freetype-2.3.4.tar.gz
tar -zxf freetype-2.3.4.tar.gz
cd freetype-2.3.4
mkdir -p /usr/local/freetype
./configure --prefix=/usr/local/freetype
make
make install

gd目录
tar -zxf gd-2.0.33.tar.gz
cd gd-2.0.33
mkdir -p /usr/local/gd2
./configure --prefix=/usr/local/gd2 --with-jpeg=/usr/local/jpeg/ --with-png=/usr/local/libpng/ --with-zlib=/usr/local/zlib/ --with-freetype=/usr/local/freetype/
make
make install

注意:
./configure --with-php-config=[php安装目录]/bin/php-config --with-jpeg=[jpeg-6b安装目录] --with-png=[libpng安装目录] --with-freetype=[freetype安装目录] --with-zlib=[zlib安装目录] --with-gd=[gd安装目录]
(若是出现未知配置项--with-png**,--with-freetype之类的错误 在配置项后面加上-dir参数便可:既修编译参数为: ./configure --with-php-config=[php安装目录]/bin/php-config --with-jpeg-dir=[jpeg安装目录] --with-png-dir=[libpng安装目录] --with-freetype-dir=[freetype安装目录] --with-zlib=[zlib安装目录] --with-gd=[gd安装目录] 便可
########################################################################
如下系统已经有libjpeg 以前yum已经安装过,就执行如下命令了

tar -zxf gd-2.0.33.tar.gz
cd gd-2.0.33
mkdir -p /usr/local/gd2
./configure --prefix=/usr/local/gd2 --with-jpeg --with-png --with-zlib --with-freetype
make
make install

进入“[php解压目录]/ext/gd”目录,执行以下命令:
cd /mnt/soft/local/src/php-5.6.17/ext/gd
[php安装目录]/bin/phpize
/usr/local/php5/bin/phpize
./configure --with-php-config=/usr/local/php5/bin/php-config --with-gd=/usr/local/gd2 --with-png-dir
make
# make成功执行后,生成的扩展库文件在当前目录的 modules 子目录下
cp modules/gd.so /usr/local/php5/lib/php/extensions/no-debug-non-zts-20131226/

# 在php.ini的添加扩展库位置,设置要添加的扩展库。
vi /usr/local/php5/etc/php.ini
extension=gd.so

重启php-fpm 重启nginx 大功告成!!!!

 

###############################
http://blog.csdn.net/21aspnet/article/details/8203447
mcrypt 扩展库用下面命令

#tar -zxvf mcrypt-2.6.8.tar.gz

#cd mcrypt-2.6.8

#LD_LIBRARY_PATH=/usr/local/lib ./configure

#make

#make install
################################

 

十。安装redis

1.检查安装依赖程序

yum install gcc-c++
yum install -y tcl

wget http://download.redis.io/releases/redis-2.8.13.tar.gz
tar -xzvf redis-2.8.19.tar.gz
mv redis-2.8.19 /usr/local/redis

cd /usr/local/redis

make
make install

mkdir -p /etc/redis
cp redis.conf /etc/redis/

vi /etc/redis/redis.conf
仅修改: daemonize yes (no-->yes)

/usr/local/bin/redis-server /etc/redis/redis.conf //启动

ps -ef | grep redis

redis-cli //使用客户端

redis-cli shutdown //关闭


2.安装PHPredis扩展
wget https://github.com/nicolasff/phpredis/archive/master.zip
unzip master.zip
cd phpredis-master
phpize
./configure --with-php-config=/usr/local/php5/bin/php-config
make
make install
vim /etc/php.ini
extension=redis.so

十一。安装xdebug

wget http://www.xdebug.org/files/xdebug-2.4.0rc3.tgz
cd xdebug-2.4.0rc3
/usr/local/php/bin/phpize
./configure --enable-xdebug --with-php-config=/usr/local/php/bin/php-config
make && make install

vi php.ini

加入 : zend_extension=xdebug.so

重启php nginx。

http://www.51testing.com/html/18/170218-3545467.html //配置
http://www.cnblogs.com/dreamhome/p/3218744.html //详解

[xdebug]
xdebug.idekey=PHPSTORM
xdebug.remote_connect_back = 1
xdebug.remote_host=192.168.31.238
xdebug.remote_enable=on
xdebug.remote_port = 9060
xdebug.remote_handler = dbgp
xdebug.auto_trace = 0
xdebug.collect_includes = 1
xdebug.collect_params = 1
xdebug.collect_return = 1
xdebug.default_enable = 1
xdebug.collect_assignments = 1
xdebug.collect_vars = 1
xdebug.remote_autostart = 1
xdebug.show_local_vars = 1
xdebug.show_exception_trace = 0


***注意最好把xdebug.auto_trace = 0; 关闭 。若是开启后可能会引起一些小问题,原来的PHP环境会出现连接被重置,把这关闭便可!

十二。linux下php添加pdo_mysql扩展
http://www.edbiji.com/doccenter/showdoc/78/nav/1002.html
进去到php的源码包的ext中
cd /usr/local/src/php-5.2.17/ext/pdo_mysql
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config --with-pdo-mysql=/usr/local/mysql
make && make install
extension=pdo_mysql.so

十三。安装git

yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel gcc perl-ExtUtils-MakeMaker
wget https://www.kernel.org/pub/software/scm/git/git-2.3.0.tar.gz
tar -zxvf git-2.3.0.tar.gz
cd git-2.3.0
make prefix=/usr/local/git all
make prefix=/usr/local/git install

#配置进入环境变量
vi /etc/profile
export PATH=$PATH:/usr/local/git/bin
source /etc/profile使配置当即生效


十四。 BItnami Gitlab
http://devtian.me/2015/03/05/gitlab-cooperation-tool-1/
http://comedsh.iteye.com/blog/2238200
http://blog.csdn.net/uniquechao/article/details/41250459

下载
wget https://downloads.bitnami.com/files/stacks/gitlab/7.6.2-0/bitnami-gitlab-7.6.2-0-linux-installer.run

chmod +x xxx.run
安装
./xxx.run

----------------------------------------------------------------------------
Welcome to the Bitnami Gitlab Stack Setup Wizard.

----------------------------------------------------------------------------
Select the components you want to install; clear the components you do not want
to install. Click Next when you are ready to continue.

GitLab : Y (Cannot be edited)

GitLab CI [Y/n] :Y

Is the selection above correct? [Y/n]: Y

----------------------------------------------------------------------------
Installation folder

Please, choose a folder to install Bitnami Gitlab Stack

Select a folder [/opt/gitlab-7.4.3-0]:


----------------------------------------------------------------------------
Create Admin account

Bitnami Gitlab Stack admin user creation

Email Address [xschao@xxx.com]:

Login [xschao]:

Password :xxxxxxxxxxx
Please confirm your password :
----------------------------------------------------------------------------
Hostname that will be used to create internal URLs. If this value is incorrect,
you may be unable to access your Gitlab installation from other computers. It is
advisable to use a Domain instead of an IP address for compatibility with
different browsers.

Domain [127.0.0.1]: 这里最好写外网ip或者域名:如192.168.31.176

Do you want to configure mail support? [y/N]: y

----------------------------------------------------------------------------
Configure SMTP Settings

This is required so your application can send notifications via email.

Default email provider:

[1] GMail
[2] Custom
Please choose an option [1] : 1

----------------------------------------------------------------------------
Configure SMTP Settings

This data is stored in the application configuration files and may be visible to
others. For this reason, it is recommended that you do not use your personal
account credentials.

GMail address []: xschao.test@gmail.com

GMail password :
Re-enter :
----------------------------------------------------------------------------
Setup is now ready to begin installing Bitnami Gitlab Stack on your computer.

Do you want to continue? [Y/n]: Y

----------------------------------------------------------------------------
Please wait while Setup installs Bitnami Gitlab Stack on your computer.

Installing
0% ______________ 50% ______________ 100%



安装完成后用提示的域名进入gitlab 如:http://127.0.0.1:84/



查看gitlab相关命令

cd /opt/gitlab-xxx/
./ctlscript.sh

usage: ./ctlscript.sh help
./ctlscript.sh (start|stop|restart|status)
./ctlscript.sh (start|stop|restart|status) mysql
./ctlscript.sh (start|stop|restart|status) apache
./ctlscript.sh (start|stop|restart|status) redis
./ctlscript.sh (start|stop|restart|status) gitlab_sidekiq
./ctlscript.sh (start|stop|restart|status) gitlabci_sidekiq
./ctlscript.sh (start|stop|restart|status) gitlabci_runner

help - this screen
start - start the service(s)
stop - stop the service(s)
restart - restart or start the service(s)
status - show the status of the service(s)


如:./ctlscript.sh restart gitlab_sidekiq //重启gitlab


####修改服务器IP地址
假如在安装gitlab的过程当中,你所有是按照默认选项安装的,当咱们建立一个project的时候,生成的仓库地址是这样的:git@127.0.0.1:username/test.git,这显示是不正确的,由于这个地址是本机地址,而开发人员作git clone操做时,是在本身的电脑上完成的,那么怎么解决这个问题呢?仍是要看 gitlab.yml 这个配置文件。
vi /opt/gitlab-7.6.2-0/apps/gitlab/htdocs/config/gitlab.yml

把host: 127.0.0.1
改为host: 192.168.32.166

/opt/gitlab-7.6.2-0/ctlscript.sh restart gitlab_sidekiq //重启gitlab服务
/opt/gitlab-7.6.2-0/ctlscript.sh restart apache //重启apache服务


十五。安装confluence
http://lschao.blog.51cto.com/7814743/1409970


十六。安装seaslog
https://github.com/Neeke/SeasLog#%E4%B8%BA%E4%BB%80%E4%B9%88%E4%BD%BF%E7%94%A8seaslog

wget https://pecl.php.net/get/SeasLog-1.5.0.tgz
tar zxvf SeasLog-1.5.0.tgz
cd SeasLog-1.5.0
phpize
./configure --with-php-config=/usr/local/php5/bin/php-config
make && make install

vi /etc/php.ini
extension = seaslog.so
seaslog.default_basepath = /log/seaslog-test ;默认log根目录
seaslog.default_logger = default ;默认logger目录
seaslog.disting_type = 1 ;是否以type分文件 1是 0否(默认)
seaslog.disting_by_hour = 1 ;是否每小时划分一个文件 1是 0否(默认)
seaslog.use_buffer = 1 ;是否启用buffer 1是 0否(默认)
seaslog.buffer_size = 100 ;buffer中缓冲数量 默认0(不使用buffer_size)
seaslog.level = 0 ;记录日志级别 默认0(全部日志)
seaslog.trace_error = 1 ;自动记录错误 默认1(开启)
seaslog.trace_exception = 0 ;自动记录异常信息 默认0(关闭)


十七。安装Composer
http://www.phpcomposer.com/

curl -sS https://getcomposer.org/installer | php
cp composer.phar /usr/local/bin/composer

#composer config repo.packagist composer http://packagist.phpcomposer.com //该国内镜像

修改当前项目的 composer.json 配置文件,如加入monolog依赖库
{
"require": {
"monolog/monolog": "1.5.*"
}
}

执行安装命令
# composer install //须要关闭xdebug

composer selfupdate //保持composer最新


###若是碰到he Process class relies on proc_open, which is not available on your PHP installation. 错误

配置php.ini文件 让其支持 proc_open、proc_get_status函数

http://www.jianshu.com/p/072e09734ffc //laravel介绍

相关文章
相关标签/搜索