安装php

Installation Guideline

 

yum install perl

 

yum install net-tools

 

yum install libaio

 

1st.Mysql5.6

wget https://dev.mysql.com/get/Downloads/MySQL-5.6/MySQL-5.6.36-1.rhel5.x86_64.rpm-bundle.tar

 

wget https://dev.mysql.com/get/Downloads/MySQL-5.6/MySQL-5.6.35-1.rhel5.x86_64.rpm-bundle.tar

 

wget  https://dev.mysql.com/get/Downloads/MySQL-5.6/MySQL-5.6.35-1.linux_glibc2.5.x86_64.rpm-bundle.tar

 

wget http://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.16-1.el7.x86_64.rpm-bundle.tar

 

 

php

 

gd:

wget http://rpms.famillecollet.com/enterprise/7/php56/x86_64/repoview/php-gd.html

rpm -ivh php-gd-5.6.30-1.el7.remi.x86_64.rpm

 

igbinary:

igbinary-master.zip

 

/usr/bin/phpize

./configure --with-php-config=/usr/local/php/bin/php-config

./configure --with-php-config=/usr/bin/php-config

make

make install

 

libevent:

yum install libevent-devel

pecl install channel://pecl.php.net/libevent-0.1.0 //提示libevent installation [autodetect]: 时按回车

echo extension=libevent.so > /etc/php.d/libevent.ini

 

php-redis:

2.2.4.tar.gz

wget https://github.com/nicolasff/phpredis/archive/2.2.4.tar.gz

tar -zxvf 2.2.4.tar.gz

cd phpredis-2.2.4/

/usr/bin/phpize

./configure --with-php-config=/usr/bin/php-config

make

make install

 

workman:

curl -Ss http://www.workerman.net/check.php | php

 

PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/libevent.so'

 

   按照workerman官网的安装步骤安装完workerman后, 使用过程中包了以下警告:

 

PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/libevent.so' - /usr/lib/php/modules/libevent.so: undefined symbol: php_sockets_le_socket in Unknown on line 0

 

原因:

 

php加载sockets 和libevent模块的顺序导致。

 

解决方法:

 

vim /etc/php.d/libevent.ini

注释掉:extension = libevent.so

 

vim /etc/php.d/sockets.ini

注释掉:extentsion = sockets.so

 

 

 

然后在php.ini中添加这两个扩展的引用

 

vim /etc/php.ini

extension = sockets.so

extension = libevent.so

 

将上面内容添加到php.ini中,注意添加顺序。

 

CentOS 7中安装Redis 3.2.8 

 

文章环境:

CentOS 7 biuld 1611最小化安装@VMware

Redis 3.2.8

安装步骤:

 

#安装gcc

yum -y install gcc

#下载redis

curl -O  http://download.redis.io/releases/redis-3.2.8.tar.gz

#解压

tar -zxvf redis-3.2.8.tar.gz

#转换目录

cd redis-3.2.8/deps/

#编译依赖

make geohash-int hiredis jemalloc linenoise lua

#转换目录

cd ..

#编译Redis

make && make install

#转换目录

cd utils/

#使用脚本安装服务

./install_server.sh

#启动服务

systemctl start redis_6379

systemctl status redis_6379

#好了,就这些,尝试一下吧。

 

简单提示:

  1. 当前版本中需要编译的依赖有五项,更早或未来的版本可能会有不同。如果您没有编译这些项目,编译Redis会遇到错误。 fatal error: jemalloc/jemalloc.h: No such file or directory
  2. cc: error: ../deps/hiredis/libhiredis.a: No such file or directory
  3. cc: error: ../deps/lua/src/liblua.a: No such file or directory
  4. cc: error: ../deps/geohash-int/geohash.o: No such file or directory
  5. cc: error: ../deps/linenoise/linenoise.o: No such file or directory
  6. 在使用脚本安装服务的过程中,您可以一路【Enter】完成安装。之后您可以再次运行脚本文件,并通过输入不同的端口号建立多个Redis服务。

 

 

 

Selected config:

Port           : 6379

Config file    : /etc/redis/6379.conf

Log file       : /var/log/redis_6379.log

Data dir       : /var/lib/redis/6379

Executable     : /usr/local/bin/redis-server

Cli Executable : /usr/local/bin/redis-cli

Is this ok? Then press ENTER to go on or Ctrl-C to abort.

Copied /tmp/6379.conf => /etc/init.d/redis_6379

Installing service...

Successfully added to chkconfig!

Successfully added to runlevels 345!

Starting Redis server...

Installation successful!

[root@vultr utils]# pwd

/usr/local/redis/redis-3.2.8/utils

[root@vultr utils]#

 

 

Step A: Install CentOS7.3 DVD

 

Step B: su root

 

Step C:

1、安装依赖库

yum -y update

yum install iptables-services

yum install telnet

Step D:

systemctl status firewalld.service #检测是否开启了firewall

 

systemctl stop firewalld.service #关闭firewall

 

systemctl disable firewalld.service #禁止firewall开机自启

 

vim /etc/sysconfig/iptables

 

-A INPUT -p tcp -m state --state NEW -m tcp --dport 21 -j ACCEPT

-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT

-A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT

-A INPUT -p tcp -m state --state NEW -m tcp --dport 8080 -j ACCEPT

-A INPUT -p tcp -m state --state NEW -m tcp --dport 3306 -j ACCEPT

-A INPUT -p tcp -m state --state NEW -m tcp --dport 4449 -j ACCEPT

 

systemctl restart iptables.service  

systemctl enable iptables.service

 

Step E关闭SELINUX

至于为什么关闭selinux,请看知乎网友的回答 GO  

vi /etc/selinux/config

#SELINUX=enforcing #注释掉

#SELINUXTYPE=targeted #注释掉

SELINUX=disabled #Added

:wq! #保存退出 

setenforce 0 #使配置立即生效

 

[root@vultr www]# ls

MySQL-client-5.6.35-1.rhel5.x86_64.rpm  MySQL-server-5.6.35-1.rhel5.x86_64.rpm

[root@vultr www]# rpm -Uvh mysql-community-release-rhel5-5.noarch.rpm^C

[root@vultr www]# rpm -Uvh MySQL-server-5.6.35-1.rhel5.x86_64.rpm

警告:MySQL-server-5.6.35-1.rhel5.x86_64.rpm: 头V3 DSA/SHA1 Signature, 密钥 ID 5072e1f5: NOKEY

错误:依赖检测失败:

/usr/bin/perl 被 MySQL-server-5.6.35-1.rhel5.x86_64 需要

libaio.so.1()(64bit) 被 MySQL-server-5.6.35-1.rhel5.x86_64 需要

libaio.so.1(LIBAIO_0.1)(64bit) 被 MySQL-server-5.6.35-1.rhel5.x86_64 需要

libaio.so.1(LIBAIO_0.4)(64bit) 被 MySQL-server-5.6.35-1.rhel5.x86_64 需要

net-tools 被 MySQL-server-5.6.35-1.rhel5.x86_64 需要

 

Step F:

//1 wget http://dev.mysql.com/get/mysql-community-release-rhel5-5.noarch.rpm

//2 rpm -Uvh mysql-community-release-rhel5-5.noarch.rpm

 

wget MySQL-server-5.6.35-1.linux_glibc2.5.x86_64.rpm 

 

2、添加MySQL YUM仓库

wget http://dev.mysql.com/Downloads/MySQL-5.6/MySQL-server-5.6.35-1.rhel5.x86_64.rpm

MySQL-client-5.6.31-1.linux_glibc2.5.x86_64.rpm

 

yum install perl

 

yum install net-tools

 

yum install libaio

 

rpm -Uvh MySQL-server-5.6.35-1.rhel5.x86_64.rpm

wget http://dev.mysql.com/Downloads/MySQL-5.6/MySQL-client-5.6.35-1.rhel5.x86_64.rpm

 

3、添加/etc/yum.repos.d/mysql-community.repo

A. vim /etc/yum.repos.d/mysql-community.repo

B. 添加内容

 

4、用yum安装MySQL

  1. yum install mysql-community-server

 

yum install mysql-community-server

 

#开机启动

systemctl enable mysqld.service

 

 systemctl start mysqld.service

 

grep "temporary password" | /var/log/mysqld.log //清除临时密码

 

创建用户密码

create user 'root'@'%' identified by 'crystal!#$86883448$#!';

grant all privileges on *.* to 'root'@'%' identified by 'crystal!#$86883448$#!' with grant option;

flush privileges;

 

5、清除旧数据库文件

  1. mv /var/lib/mysql /var/lib/mysql-bak

 

6、启动MySQL

  1. systemctl start mysqld.service

 

7YUM安装MySQL目录说明

  1. /var/log/mysqld.log #MySQL日志目录
  2. /var/lib/mysql #MySQL数据文件目录
  3. /usr/share/mysql/ #MySQL配置文件目录
  4. /usr/bin/ #MySQL启动脚本目录

 

8、设置用户

  1. CREATE user test_user;
  2. USE mysql;
  3. UPDATE user SET password=PASSWORD("TEST_PASSWORD") WHERE user='test_user';
  4. GRANT ALL ON *.* TO 'test_user'@'%';
  5. FLUSH PRIVILEGES;

 

9、设置默认字符编码

①、添加my.cnf(若存在此文件,请忽略此步骤)

  1. cp /usr/share/mysql/my-default.cnf /etc/my.cnf

 

②、查询数据库编码

  1. show variables like 'character_set_%';

 

③、修改/etc/my.cnf

添加内容:

  1. character_set_server=utf8

 

2nd. Apache Httpd

 

A.

 yum -y install httpd

 

B.

systemctl start httpd.service

 

systemctl stop httpd.service

 

systemctl restart httpd.service

 

systemctl enable httpd.service

 

3rd.  php

php

yum -y install php*

php组件支持mysql

//yum install php-mysql php-gd libjpeg* php-ldap php-odbc php-pear php-xml php-xmlrpc php-bcmath php-mhash

 

yum install php56w.x86_64 php56w-cli.x86_64 php56w-common.x86_64 php56w-gd.x86_64 php56w-ldap.x86_64 php56w-mbstring.x86_64 php56w-mcrypt.x86_64 php56w-mysql.x86_64 php56w-pdo.x86_64

 

添加源

yum install epel-release

rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm

查看源

yum list --enablerepo=remi --enablerepo=remi-php56 | grep php

安装php

yum install --enablerepo=remi --enablerepo=remi-php56 php php-opcache php-devel php-mbstring php-mcrypt php-mysqlnd php-phpunit-PHPUnit php-pecl-xdebug php-pecl-xhprof

 

yum --enablerepo=remi install php php-fpm

 

systemctl restart mysqld.service

 

systemctl restart httpd.service

 

systemctl restart php-fpm

systemctl enable php-fpm

 

posted @ 2018-06-25 14:05  JackyTang  阅读(376)  评论(0编辑  收藏  举报