安装php相关环境
安装epel仓库
yum -y install epel-release
安装PHP的yum源
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
开始安装
yum install php71w-cli php71w-process git gcc php71w-devel php71w-pear -y /* * php_cli (workerman运行在php cli下) * php-process (为进程控制相关扩展,包括posix和pcntl) * git (用于下载或者更新workerman源代码) * gcc php-devel php-pear (用于安装php的Event扩展) */ yum install libevent-devel -y //libevent-devel (用于安装php的Event扩展)
安装Event扩展
pecl install event /* * 出现下列提示时输入no回车,其他提示直接回车 * Include libevent OpenSSL support [yes] : */ echo extension=event.so > /etc/php.d/event.ini //(如果ini文件位置不对,可以通过运行php --ini找到实际加载的ini文件路径)
下载workerman
检测本地环境是否满足
curl -Ss http://www.workerman.net/check.php | php
通过git下载
git clone https://github.com/walkor/Workerman
安装mysql组件支持
yum install php71w-pdo php71w-mysql
安装MariaDB
通过yum安装
yum -y install mariadb mariadb-server
设置开机自启
systemctl enable mariadb.service
重启MariaDB
systemctl restart mariadb.service
进行安全设置
mysql_secure_installation /* * 各提示详解: * Enter current password for root (enter for none):<–直接回车 * * Set root password? [Y/n] <– 是否设置root用户密码,输入y并回车或直接回车 * New password: <– 设置root用户的密码 * Re-enter new password: <– 再输入一次你设置的密码 * * Remove anonymous users? [Y/n] <– 是否删除匿名用户,生产环境建议删除,所以直接回车 * * Disallow root login remotely? [Y/n] <–是否禁止root远程登录,根据自己的需求选择Y/n并回车,建议禁止 * * Remove test database and access to it? [Y/n] <– 是否删除test数据库,直接回车 * * Reload privilege tables now? [Y/n] <– 是否重新加载权限表,直接回车 */ systemctl restart mariadb.service //完成向导后重启服务
进入控制台
mysql -u root -p /* * Enter password: * 出现此提示后输入您的密码并按下回车 * * MariaDB [(none)]> * 表示成功进入 * * 输入quit * 即可退出控制台 * * 如出现以下错误: * mariadb 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) * 请参考http://blog.csdn.net/u014455868/article/details/57082304 */