centos6.5下安装php7,nginx,mysql,redis.composer
2017-03-07 14:35
681 查看
我的linux环境 centos. 6.5
安装php7.0.2,nginx1.10.2 ,mysql 5.7,redis2.8.3
http://blog.csdn.net/21aspnet/article/details/47708763
PHP下PHP安装
wget http://php.NET/get/php-7.0.2.tar.gz/from/a/mirror
tar zxvf php-7.0.2.tar.gz
cd php-7.0.2
PHP配置信息
./configure \
--prefix=/usr/local/php7 \
--exec-prefix=/usr/local/php7 \
--with-config-file-path=/usr/local/php7/etc \
--with-curl \
--with-freetype-dir \
--with-gd \
--with-gettext \
--with-iconv-dir \
--with-kerberos \
--with-libdir=lib64 \
--with-libxml-dir \
--with-mysqli \
--with-openssl \
--with-pcre-regex \
--with-pdo-mysql \
--with-pdo-sqlite \
--with-pear \
--with-png-dir \
--with-xmlrpc \
--with-xsl \
--with-zlib \
--with-zlib-dir \
--with-mhash \
--with-mcrypt \
--with-openssl-dir \
--with-jpeg-dir \
--enable-gd-jis-conv \
--enable-fpm \
--enable-bcmath \
--enable-libxml \
--enable-inline-optimization \
--enable-gd-native-ttf \
--enable-mbregex \
--enable-mbstring \
--enable-opcache \
--enable-pcntl \
--enable-shmop \
--enable-soap \
--enable-sockets \
--enable-sysvsem \
--enable-xml \
--enable-zip
如果需要安装依赖 看缺少哪个。就安装哪个
yum -y install libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel MySQL pcre-devel
yum -y install curl-devel
yum -y install libxslt-devel
make && make install
配置文件
# cp php.ini-development /usr/local/php/lib/php.ini
# cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
# cp /usr/local/php/etc/php-fpm.d/www.conf.default /usr/local/php/etc/php-fpm.d/www.conf
# cp -R ./sapi/fpm/php-fpm /etc/init.d/php-fpm
启动
# /etc/init.d/php-fpm
编译安装Nginx
http://blog.csdn.net/unix21/article/details/8544922
# wget http://nginx.org/download/nginx-1.10.2.tar.gz
# tar -zvxf nginx-1.10.2.tar.gz
# cd ./nginx-1.10.2
Nginx配置信息
./configure --prefix=/usr/local/nginx --sbin-path=/usr/local/nginx/sbin/nginx --conf-path=/usr/local/nginx/conf/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log
--pid-path=/var/run/nginx/nginx.pid --lock-path=/var/lock/nginx.lock --user=nginx --group=nginx --with-http_ssl_module --with-http_stub_status_module --with-http_gzip_static_module --http-client-body-temp-path=/var/tmp/nginx/client/ --http-proxy-temp-path=/var/tmp/nginx/proxy/
--http-fastcgi-temp-path=/var/tmp/nginx/fcgi/ --http-uwsgi-temp-path=/var/tmp/nginx/uwsgi --http-scgi-temp-path=/var/tmp/nginx/scgi --with-pcre
缺少依赖的话
# yum -y install pcre-devel openssl openssl-devel
启动nginx
# /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
启动nginx
/usr/local/nginx/sbin/nginx/
重启nginx /usr/local/nginx/sbin/nginx -s reload
停止服务 /usr/local/nginx/sbin/nginx -s stop
安装成功查看nginx进程
# ps aux | grep nginx
ps -ef |
grep nginx
PHP7中php.ini、php-fpm和www.conf的配置
https://typecodes.com/web/php7configure.html
http://www.jb51.net/article/87160.htm?pc
mysql安装
wget http://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.13-linux-glibc2.5-x86_64.tar.gz tar -xzvf mysql-5.7.13-linux-glibc2.5-x86_64.tar.gz
bash: mysql: command not found
ln -s /usr/local/mysql/bin/mysql /usr/bin
ln -fs /MYSQLPATH/bin/mysql mysql #其中MYSQLPATH是mysql的实际安装路径
还有其它常用命令mysqladmin、mysqldump等不可用时候都可按用此方法解决
mysql登录报错“Access denied for user 'root'@'localhost' (using password: NO”)的处理方法
并且bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/data/mysql 没有生成密码
修改/etc/my.conf 添加
skip-grant-tables
然后mysql -u root
就可以登录进去了!!!哈哈哈哈
mysql 5.7 没有Password字段了 需要用、authentication_string
update user set authentication_string = password("*******") where user="root";
创建软连接 php可以直接使用
ln /etc/init.d/php-fpm /usr/local/sbin/php
php-fpm 重启 /etc/init.d/php-fpm restart
redis启动
cd /usr/local/redis
启动服务
redis-server /usr/local/redis/redis.conf
启动客户端
Redis-cli 启动redis 客户端
Pkill redis-server 关闭redis服务
Redis-cli shutdown 关闭redis客户端
Netstat -tunpl|grep 6379 查看redis 默认端口号6379占用情况
php7安装redis和mysql扩展
http://www.jb51.net/article/93876.htm
安装redis扩展
wget -c https://github.com/phpredis/phpredis/archive/php7.zip unzip php7.zip
cd phpredis-php7
/usr/local/php7/bin/phpize
./configure --with-php-config=/usr/local/php7/bin/php-config
make
make
install
cd ..
/usr/local/php7/etc/php.ini 中加入:
extension=redis.so
重启php即可看到redis的扩展
主机和虚拟机可以ping通,但是主机却访问不了虚拟机配置的nginx
vi /etc/selinux/config
改
SELINUX=disabled
然后重启点脑reboot
重启后然后关闭防火墙iptables
service iptables stop
chkconfig iptables off(开机不启动)。
然后就可以了!!!!哈哈哈哈
然后基本的环境配置完毕!
创建直接可以执行
php ln /usr/local/php7/bin/php /usr/local/sbin/php
nginx ln /usr/local/nginx/sbin/nginx /usr/local/sbin/nginx
呵呵哈哈哈
软连接!!!可以的!!!
安装composer
curl -sS https://getcomposer.org/installer | php 或者 php -r "readfile('https://getcomposer.org/installer');" | php
然后全局化composer命令
mv composer.phar /usr/local/bin/composer
配置共享
将本地的地址共享到虚拟机。然后再虚拟机 /mnt/hgfs/共享的目录 这里可以看到共享的目录
执行 composer create-project --prefer-dist laravel/laravel blog "5.3.*"
php artisan optimize
php artisan key:generate
在这之前需要修改nginx.conf的配置信息
然后 加一个server
server {
listen 80;
server_name test.com;
index index.php
location ~ \.php$ {
root /mnt/hgfs/www/blog/public;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
server { listen 80; server_name localhost; set $root_path '/usr/local/app/snsprj/public'; root $root_path; index index.php index.html
index.htm; try_files $uri $uri/ @rewrite; location @rewrite { rewrite ^/(.*)$ /index.php?_url=/$1; } location ~ \.php { fastcgi_pass 127.0.0.1:9000; fastcgi_index /index.php; fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } location ~* ^/(css|img|js|flv|swf|download)/(.+)$ { root $root_path; } location ~ /\.ht { deny all;
} }
允许其他主机访问mysql
update user set host = '%' where user = 'root';
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED
BY 'root' WITH GRANT OPTION;
FLUSH PRIVILEGES
git 生成SSH KEY
git config --global user.name "baidushanxi"
git config --global user.email "baidushanxi@vip.qq.com"
查看是否已经生成了ssh密匙
按3个回车 --------》》》》》》》》》》》》》网上说这里密码为空一般不使用密码,貌似是设置密码的地方
cd ~/.ssh
得到了两个文件:id_rsa和id_rsa.pub
然后。。。登录baidushanxi ,在设置中
把 id_rsa.pub里面的内容复制到 SSH 新添加即可
(呃呃呃。。。不同的项目貌似用的都是这个ssh,可以一人下载不同的项目)
.测试:ssh
git@github.com
出现这个应该就是成功了!
ERROR: Hi tekkub!
You’ve successfully authenticated, but GitHub does not provide shell access
Connection to github.com closed.
克隆项目到本地
git clone git@github.com:username/gitproj.git
安装php7.0.2,nginx1.10.2 ,mysql 5.7,redis2.8.3
http://blog.csdn.net/21aspnet/article/details/47708763
PHP下PHP安装
wget http://php.NET/get/php-7.0.2.tar.gz/from/a/mirror
tar zxvf php-7.0.2.tar.gz
cd php-7.0.2
PHP配置信息
./configure \
--prefix=/usr/local/php7 \
--exec-prefix=/usr/local/php7 \
--with-config-file-path=/usr/local/php7/etc \
--with-curl \
--with-freetype-dir \
--with-gd \
--with-gettext \
--with-iconv-dir \
--with-kerberos \
--with-libdir=lib64 \
--with-libxml-dir \
--with-mysqli \
--with-openssl \
--with-pcre-regex \
--with-pdo-mysql \
--with-pdo-sqlite \
--with-pear \
--with-png-dir \
--with-xmlrpc \
--with-xsl \
--with-zlib \
--with-zlib-dir \
--with-mhash \
--with-mcrypt \
--with-openssl-dir \
--with-jpeg-dir \
--enable-gd-jis-conv \
--enable-fpm \
--enable-bcmath \
--enable-libxml \
--enable-inline-optimization \
--enable-gd-native-ttf \
--enable-mbregex \
--enable-mbstring \
--enable-opcache \
--enable-pcntl \
--enable-shmop \
--enable-soap \
--enable-sockets \
--enable-sysvsem \
--enable-xml \
--enable-zip
如果需要安装依赖 看缺少哪个。就安装哪个
yum -y install libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel MySQL pcre-devel
yum -y install curl-devel
yum -y install libxslt-devel
make && make install
配置文件
# cp php.ini-development /usr/local/php/lib/php.ini
# cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
# cp /usr/local/php/etc/php-fpm.d/www.conf.default /usr/local/php/etc/php-fpm.d/www.conf
# cp -R ./sapi/fpm/php-fpm /etc/init.d/php-fpm
启动
# /etc/init.d/php-fpm
编译安装Nginx
http://blog.csdn.net/unix21/article/details/8544922
# wget http://nginx.org/download/nginx-1.10.2.tar.gz
# tar -zvxf nginx-1.10.2.tar.gz
# cd ./nginx-1.10.2
Nginx配置信息
./configure --prefix=/usr/local/nginx --sbin-path=/usr/local/nginx/sbin/nginx --conf-path=/usr/local/nginx/conf/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log
--pid-path=/var/run/nginx/nginx.pid --lock-path=/var/lock/nginx.lock --user=nginx --group=nginx --with-http_ssl_module --with-http_stub_status_module --with-http_gzip_static_module --http-client-body-temp-path=/var/tmp/nginx/client/ --http-proxy-temp-path=/var/tmp/nginx/proxy/
--http-fastcgi-temp-path=/var/tmp/nginx/fcgi/ --http-uwsgi-temp-path=/var/tmp/nginx/uwsgi --http-scgi-temp-path=/var/tmp/nginx/scgi --with-pcre
缺少依赖的话
# yum -y install pcre-devel openssl openssl-devel
启动nginx
# /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
启动nginx
/usr/local/nginx/sbin/nginx/
重启nginx /usr/local/nginx/sbin/nginx -s reload
停止服务 /usr/local/nginx/sbin/nginx -s stop
安装成功查看nginx进程
# ps aux | grep nginx
ps -ef |
grep nginx
PHP7中php.ini、php-fpm和www.conf的配置
https://typecodes.com/web/php7configure.html
http://www.jb51.net/article/87160.htm?pc
mysql安装
wget http://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.13-linux-glibc2.5-x86_64.tar.gz tar -xzvf mysql-5.7.13-linux-glibc2.5-x86_64.tar.gz
bash: mysql: command not found
ln -s /usr/local/mysql/bin/mysql /usr/bin
ln -fs /MYSQLPATH/bin/mysql mysql #其中MYSQLPATH是mysql的实际安装路径
还有其它常用命令mysqladmin、mysqldump等不可用时候都可按用此方法解决
mysql登录报错“Access denied for user 'root'@'localhost' (using password: NO”)的处理方法
并且bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/data/mysql 没有生成密码
修改/etc/my.conf 添加
skip-grant-tables
然后mysql -u root
就可以登录进去了!!!哈哈哈哈
mysql 5.7 没有Password字段了 需要用、authentication_string
update user set authentication_string = password("*******") where user="root";
创建软连接 php可以直接使用
ln /etc/init.d/php-fpm /usr/local/sbin/php
php-fpm 重启 /etc/init.d/php-fpm restart
redis启动
cd /usr/local/redis
启动服务
redis-server /usr/local/redis/redis.conf
启动客户端
Redis-cli 启动redis 客户端
Pkill redis-server 关闭redis服务
Redis-cli shutdown 关闭redis客户端
Netstat -tunpl|grep 6379 查看redis 默认端口号6379占用情况
php7安装redis和mysql扩展
http://www.jb51.net/article/93876.htm
安装redis扩展
wget -c https://github.com/phpredis/phpredis/archive/php7.zip unzip php7.zip
cd phpredis-php7
/usr/local/php7/bin/phpize
./configure --with-php-config=/usr/local/php7/bin/php-config
make
make
install
cd ..
/usr/local/php7/etc/php.ini 中加入:
extension=redis.so
重启php即可看到redis的扩展
主机和虚拟机可以ping通,但是主机却访问不了虚拟机配置的nginx
vi /etc/selinux/config
改
SELINUX=disabled
然后重启点脑reboot
重启后然后关闭防火墙iptables
service iptables stop
chkconfig iptables off(开机不启动)。
然后就可以了!!!!哈哈哈哈
然后基本的环境配置完毕!
创建直接可以执行
php ln /usr/local/php7/bin/php /usr/local/sbin/php
nginx ln /usr/local/nginx/sbin/nginx /usr/local/sbin/nginx
呵呵哈哈哈
软连接!!!可以的!!!
安装composer
curl -sS https://getcomposer.org/installer | php 或者 php -r "readfile('https://getcomposer.org/installer');" | php
然后全局化composer命令
mv composer.phar /usr/local/bin/composer
配置共享
将本地的地址共享到虚拟机。然后再虚拟机 /mnt/hgfs/共享的目录 这里可以看到共享的目录
执行 composer create-project --prefer-dist laravel/laravel blog "5.3.*"
php artisan optimize
php artisan key:generate
在这之前需要修改nginx.conf的配置信息
然后 加一个server
server {
listen 80;
server_name test.com;
index index.php
location ~ \.php$ {
root /mnt/hgfs/www/blog/public;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
server { listen 80; server_name localhost; set $root_path '/usr/local/app/snsprj/public'; root $root_path; index index.php index.html
index.htm; try_files $uri $uri/ @rewrite; location @rewrite { rewrite ^/(.*)$ /index.php?_url=/$1; } location ~ \.php { fastcgi_pass 127.0.0.1:9000; fastcgi_index /index.php; fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } location ~* ^/(css|img|js|flv|swf|download)/(.+)$ { root $root_path; } location ~ /\.ht { deny all;
} }
允许其他主机访问mysql
update user set host = '%' where user = 'root';
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED
BY 'root' WITH GRANT OPTION;
FLUSH PRIVILEGES
git 生成SSH KEY
git config --global user.name "baidushanxi"
git config --global user.email "baidushanxi@vip.qq.com"
查看是否已经生成了ssh密匙
按3个回车 --------》》》》》》》》》》》》》网上说这里密码为空一般不使用密码,貌似是设置密码的地方
cd ~/.ssh
得到了两个文件:id_rsa和id_rsa.pub
然后。。。登录baidushanxi ,在设置中
把 id_rsa.pub里面的内容复制到 SSH 新添加即可
(呃呃呃。。。不同的项目貌似用的都是这个ssh,可以一人下载不同的项目)
.测试:ssh
git@github.com
出现这个应该就是成功了!
ERROR: Hi tekkub!
You’ve successfully authenticated, but GitHub does not provide shell access
Connection to github.com closed.
克隆项目到本地
git clone git@github.com:username/gitproj.git
相关文章推荐
- centos 7 yum命令安装 Nginx、PHP 7、MySQL 57 、redis
- CentOS-6.5下编译安装LNMP环境【nginx1.8.1、mysql5.5.43、php 5.6】
- centos6.5安装配置nginx+php+mysql+httpsqs+ttserver+redis
- CentOS 6.4下安装Nginx+MYSQL+Lua+Redis(下)
- Nginx 1.5.2 + PHP 5.5.1 + MySQL 5.6.10 + Phalcon + Thrift + Composer在 CentOS 下的编译安装
- centos 6.5下安装mysql+nginx+redmine 3.1.0 笔记
- centos6.5下安装lnmp环境(nginx+linux+mysql+php)[yum安装]
- centos下gitlab私服完整安装部署(nginx+MySQL+redis+gitlab-ce+gitlab-shell+)
- CentOS 6.x 7.x yum安装nginx1.12-php7-mysql5.7环境
- 阿里云CentOS7.3版本安装Java jdk/MySQL/Nginx/Tomcat/Redis个人记录
- CentOS_6.5下安装Nginx+PHP+MySQL
- CentOS 6.4下安装Nginx+MYSQL+Lua+Redis(上)
- CentOS 安装 PHP5.5+Redis+XDebug+Nginx+MySQL全纪录
- Linux(centOS)手动安装Apache+MySQL+PHP+Memcached+Nginx原创无错版
- 1分钟完美安装最新 CentOS + Nginx + PHP-FPM + MySQL
- 64位centos上nginx,php编译安装遇configure: error: Cannot find libmysqlclient under /usr 错误解决
- CentOS 编译 nginx+php+mysql 安装手记
- 1分钟完美安装 CentOS + Nginx + PHP-FPM + MySQL
- CentOS上yum安装nginx+mysql+php+php-fastcgi [经本人整理后亲自测试]
- 1分钟完美安装最新 CentOS + Nginx + PHP-FPM + MySQL