2022年LinuxWapgame服务器安装与配置文档 .pdf
-
资源ID:27266263
资源大小:306.57KB
全文页数:25页
- 资源格式: PDF
下载积分:4.3金币
快捷下载
![游客一键下载](/images/hot.gif)
会员登录下载
微信登录下载
三方登录下载:
微信扫一扫登录
友情提示
2、PDF文件下载后,可能会被浏览器默认打开,此种情况可以点击浏览器菜单,保存网页到桌面,就可以正常下载了。
3、本站不支持迅雷下载,请使用电脑自带的IE浏览器,或者360浏览器、谷歌浏览器下载即可。
4、本站资源下载后的文档和图纸-无水印,预览文档经过压缩,下载后原文更清晰。
5、试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
|
2022年LinuxWapgame服务器安装与配置文档 .pdf
Linux Wap Game 服务器安装与配置1 Linux wap game服务器安装与配置(author: yubingxing) 一、 准备安装1、下载软件:以上是需要下载并安装的软件,最新版本请自行从Google 搜索下载。2、解压缩有压缩包使用 tar zxvf xxx.tar.gz 和 tar jxvf xxx.tar.bz2来解压缩。二、 安装步骤1、检查网络配置:更改 /etc/sysconfig/network-script/ifcfg-eth0文件来实现更改网卡工作参数。其中 eth0代表要更改的是系统的第一块网卡,如果更改的是系统的其他网卡请自行选择要更名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 1 页,共 25 页 - - - - - - - - - Linux Wap Game 服务器安装与配置2 改的文件。例如:# Broadcom Corporation NetXtreme II BCM5709 Gigabit Ethernet DEVICE=eth0 BOOTPROTO=none HWADDR=00:24:E8:60:47:67 ONBOOT=yes NETMASK=255.255.255.248 IPADDR=221.179.216.83 GATEWAY=221.179.216.86 TYPE=Ethernet USERCTL=no IPV6INIT=no PEERDNS=yes 修改完毕保存后使用# ifconfig eth0 down 或者ifdown eth0 , 停止 eth0 接口# ifconfig eth0 up 或者 ifup eth0 , 开启 eth0 接口来重新更新网络配置。更改主机名需要修改以下两个文件,分别是/etc/sysconfig/network和/etc/hosts,使用 vi /etc/sysconfig/network打开 network 文件,将HOSTNAME一项的值改为你想要更改为的主机名,保存退出后使用vi /etc/hosts 打开 hosts 文件,在文件末尾添加 你想要更改为的主机名,注意 IP 地址和主机名之间必须用空格 隔 开 , 并 且 在 原 文 件 中127.0.0.1 localhost.localdomain localhost一 行 的localhost.localdomain一行前面添加你想要修改为的主机名。注意:你想要修改为的主机名和localhost.localdomain 之间必须有至少一个空格。完成编辑后保存退出。注意这两个文件中的三处的主机名必须一致。2、检查防火墙配置:设置防火墙vim /etc/sysconfig/iptables 重启防火墙/etc/init.d/iptables restart 查看防火墙/etc/init.d/iptables status 配置例如:# Firewall configuration written by system-config-securitylevel # Manual customization of this file is not recommended. *filter :INPUT ACCEPT 0:0 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 2 页,共 25 页 - - - - - - - - - Linux Wap Game 服务器安装与配置3 :FORWARD ACCEPT 0:0 :OUTPUT ACCEPT 0:0 :RH-Firewall-1-INPUT - 0:0 -A INPUT -j RH-Firewall-1-INPUT -A FORWARD -j RH-Firewall-1-INPUT -A RH-Firewall-1-INPUT -i lo -j ACCEPT -A RH-Firewall-1-INPUT -p icmp -icmp-type any -j ACCEPT -A RH-Firewall-1-INPUT -p 50 -j ACCEPT -A RH-Firewall-1-INPUT -p 51 -j ACCEPT -A RH-Firewall-1-INPUT -p udp -dport 5353 -d 224.0.0.251 -j ACCEPT -A RH-Firewall-1-INPUT -p udp -m udp -dport 631 -j ACCEPT -A RH-Firewall-1-INPUT -p tcp -m tcp -dport 631 -j ACCEPT -A RH-Firewall-1-INPUT -m state -state ESTABLISHED,RELATED -j ACCEPT -A RH-Firewall-1-INPUT -m state -state NEW -m tcp -p tcp -dport 80 -j ACCEPT -A RH-Firewall-1-INPUT -m state -state NEW -m tcp -p tcp -dport 21 -j ACCEPT -A RH-Firewall-1-INPUT -m state -state NEW -m tcp -p tcp -dport 22 -j ACCEPT -A RH-Firewall-1-INPUT -m state -state NEW -m tcp -p tcp -dport 23 -j ACCEPT -A RH-Firewall-1-INPUT -m state -state NEW -m tcp -p tcp -dport 3389 -j ACCEPT -A RH-Firewall-1-INPUT -j REJECT -reject-with icmp-host-prohibited COMMIT 3、设置时间:Red Hat Linux: tzselect 选择 Asia/Shanghai cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime vim /etc/sysconfig/clock 修改 ZONE=Asia/Shanghai UTC=false ARC=false ntpdate cn.pool.ntp.org hwclock systohc Gentoo: 在 Gentoo 下设置时区的方法如下:ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime 修改 /etc/conf.d/clock ,将其中的CLOCK 设置为 local ,即: CLOCK=local 这也是 Gentoo 下正确的时区设置方法,因此可以认为gentoo 的设置没有问题, 问题出在 Ubuntu上。Ubuntu: Ububtu 在默认情况下认为BIOS 中的时间是UTC 时间, 而我的 Gentoo在如上的设置下认为BIOS中的时间是本地时间,因此就产生了不同步的问题,相差八个小时,解决的方法也很简单:在 Ubuntu 下修改 /etc/default/rcS 文件,将UTC=yes 改为UTC=no 即可。注: Ubuntu 下也是把 /etc/localtime 链接到 /usr/share/zoneinfo/Asia/Shanghai。4、设置默认字符集:名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 3 页,共 25 页 - - - - - - - - - Linux Wap Game 服务器安装与配置4 修改 /etc/sysconfig/i18n: LANG=en_US.UTF-8 SUPPORTED=en_US:en:en_US.UTF-8 SYSFONT=latarcyrheb-sun16 修改 /etc/rc.local: 加入 export LANG=uc_EN5、安装 MySQL :建立用户:groupadd mysql useradd g mysql mysql 安装:cd mysql-5.4.3-beta ./configure -prefix=/usr/local/mysql with-extra-charsets=utf8 with-plugins=all make make install 配置:cp support-files/my-f /etc/f scripts/mysql_install_db cp support-files/mysql.server /etc/init.d/mysqld chmod 750 /etc/init.d/mysqld chmod R 750 /usr/local/mysql chgrp R mysql /usr/local/mysql/var cp /usr/local/mysql/libexec/mysqld /usr/local/mysql/libexec/mysqld.old 启动服务:/etc/init.d/mysqld start 设置 root 密码:mysqladmin uroot password “ root147258369”cp /usr/local/mysql/include/mysql/mysql.h /usr/local/mysql/ 设置开机自启动:vim /etc/rc.local 在最后面加上/etc/init.d/mysqld start 6、安装 libevent :cd libevent-1.4.12-stable ./configure prefix=/usr/ & make & make install7、安装 memcached: cd memcached-1.4.2 ./configure prefix=/usr/local/memcached with-libevent=/usr/ & make & make 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 4 页,共 25 页 - - - - - - - - - Linux Wap Game 服务器安装与配置5 install 启动服务:/usr/local/memcached/bin/memcached l 127.0.0.1 d p 10000 u root m 256 设置开机启动,在/etc/rc.local 中加入上面这行编写 /etc/init.d 脚本:vim /etc/init.d/memcached 内容如下:#!/bin/bash MEMCACHED=/usr/local/memcached/bin/memcache RETVAL=0 case A VG$1 in AVGstart) echo Starting memcached . $ MEMCACHED l 127.0.0.1 d p 10000 u root m 256 RETVAL=$? ; AVGstop) echo Stopping memcached . killall -QUIT memcached RETVAL=$? ; AVGrestart) echo Restarting memcached . killall -HUP memcached RETVAL=$? ; AVG) $ MEMCACHED RETVAL=$? ; *) echo Usage: memcache start|stop|restart exit 1 ; esac 保存退出chmod 700 /etc/init.d/memcache 8、安装 zlib cd zlib-1.2.3 ./configure & make & make install 9、安装 jpeg6 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 5 页,共 25 页 - - - - - - - - - Linux Wap Game 服务器安装与配置6 建立目录:mkdir -p /usr/local/jpeg6 mkdir -p /usr/local/jpeg6/bin mkdir -p /usr/local/jpeg6/lib mkdir -p /usr/local/jpeg6/include mkdir -p /usr/local/jpeg6/man mkdir -p /usr/local/jpeg6/man1 mkdir -p /usr/local/jpeg6/man/man1 cd jpeg-7/ ./configure -prefix=/usr/local/jpeg6/ -enable-shared -enable-static make & make install10 、 安装 libpng cd libpng-1.2.41beta04 cp scripts/makefile.linux makefile make & make install11 、 安装 freetype cd freetype-2.1.10 ./configure prefix=/usr/local/freetype & make & make install12 、 安装 gettext cd gettext-0.17 ./configure prefix=/usr cp /usr/lib/libattr.* /lib/ make make install13 、 安装 gd2 cd gd-2.0.36RC1 ./configure prefix=/usr/local/gd with-jpeg=/usr/local/jpeg6/ -with-png with-zlib with-freetype=/usr/local/freetype make & make install14 、 安装 libiconv cd libiconv-1.13.1 ./configure prefix=/usr/local/iconv & make & make install 15 、 安装 libmcrypt cd libmcrypt-2.5.7 ./configure & make & make install /sbin/ldconfig cd libltdl/ ./configure enable-ltdl-install 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 6 页,共 25 页 - - - - - - - - - Linux Wap Game 服务器安装与配置7 make make install 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.116 、 安装 mhash cd mhash ./configure & make & make install 17 、 安装 mcrypt cd mcrypt-2.6.8 /sbin/ldconfig ./configure & make & make install18 、 安装 libexpat cd expat-2.0.1 ./configure -prefix=/usr/local/expat make & make install 19 、 安装 libxml2 cd libxml2-2.7.6 ./configure -prefix=/usr/local/libxml2 & make & make install20 、 安装 libxslt (不必安装该扩展库)cd libxslt-1.1.26 ./configure -prefix=/usr/local/libxslt with-libxml-prefix=/usr/local/libxml2 make & make install21 、 安装 php 添加 php-fpm 补丁,使支持php-fastcgi 和 fpm 创建 cgi 进程。i.对于php 5.2.x 需要下载: php-5.2.11-fpm-0.5.13.diff.gz gzip -cd php-5.2.11-fpm-0.5.13.diff.gz | patch -d php-5.2.11 -p1 ii.对于php 5.3.x 需要下载: php-5.3.0-fpm-0.5.12.diff.gz gzip cd php-5.3.0-fpm-0.5.12.diff.gz | patch d php-5.3.0 p1 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 7 页,共 25 页 - - - - - - - - - Linux Wap Game 服务器安装与配置8 iii.安装 php 5.3.0 tar jxvf php-5.2.11.tar.bz2 gzip -cd php-5.2.11-fpm-0.5.13.diff.gz | patch -d php-5.2.11 -p1 cd php-5.2.11 ./configure -prefix=/usr/local/php -with-mysql=/usr/local/mysql -with-gd=/usr/local/gd -with-jpeg-dir=/usr/local/jpeg6 -with-png-dir=/usr/local/ -with-zlib -with-freetype-dir=/usr/local/freetype -with-libxml-dir=/usr/local/libxml2 -enable-shared -enable-magic-quotes -with-iconv -without-sqlite -with-mcrypt -with-iconv=/usr/local/iconv -without-pdo-sqlite -with-gettext=/usr -with-curl -with-curlwrappers -enable-mbregex -enable-fastcgi -enable-fpm -enable-force-cgi-redirect -enable-mbstring -with-mhash -enable-pcntl -enable-sockets -with-config-file-path=/usr/local/php/etc -enable-dom -with-xsl=/usr/local/libxslt -disable-simplexml -enable-roxen-zts 如果编译碰到错误:error while loading shared libraries: /usr/local/gd/lib/libgd.so.2: cannot restore segment prot after reloc: Permission denied 这个错误是因为打开了RedHat 的 SELinux ,但是关闭会导致其他访问权限问题。所以可以修改/etc/selinux/config 文件中的SELINUX= 为 disabled ,然后重启。chcon -t textrel_shlib_t /usr/local/gd/lib/* 编译安装:make ZEND_EXTRA_LIBS=-liconv make install make test cp php.ini-production /usr/local/php/etc/php.ini 22 、 编译安装 PHP5 扩展模块 memcache-2.2.5.tgz cd memcache-2.2.5/ /usr/local/php/bin/phpize ./configure -with-php-config=/usr/local/php/bin/php-config make make install23 、 编译安装 PHP5 扩展模块 eaccelerator-0.9.5.3.tar.bz2 cd eaccelerator-0.9.5.3 /usr/local/php/bin/phpize ./configure -enable-eaccelerator=shared 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 8 页,共 25 页 - - - - - - - - - Linux Wap Game 服务器安装与配置9 -with-php-config=/usr/local/php/bin/php-config make make install24 、 编译安装 PHP5 扩展模块 PDO_MYSQL_1.0.2.tgz cd PDO_MYSQL-1.0.2/ /usr/local/php/bin/phpize ./configure -with-php-config=/usr/local/php/bin/php-config -with-pdo-mysql=/usr/local/mysql make make install 三、 优化配置1、配置 eAccelerator加速 PHP mkdir p /usr/local/eaccelerator_cache 修改 php.ini vim /usr/local/php/etc/php.ini 手工修改:查找/usr/local/php/etc/php.ini中的extension_dir = ./ 修改为extension_dir = /usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/ 并在此行后增加以下几行,然后保存:extension = memcache.so extension = pdo_mysql.so 再查找 output_buffering = Off 修改为 output_buffering = On 按键跳到配置文件的最末尾,加上以下配置信息:eaccelerator zend_extension=/usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/eaccelerator.so eaccelerator.shm_size=128 eaccelerator.cache_dir=/usr/local/eaccelerator_cache eaccelerator.enable=1 eaccelerator.optimizer=1 eaccelerator.check_mtime=1 eaccelerator.debug=0 eaccelerator.filter= eaccelerator.shm_max=0 eaccelerator.shm_ttl=300 eaccelerator.shm_prune_period=120 eaccelerator.shm_only=0 press=1 press_level=9 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 9 页,共 25 页 - - - - - - - - - Linux Wap Game 服务器安装与配置10 修改配置文件vi /etc/sysctl.conf 输入以下内容kernel.shmmax = 4294967295 然后执行以下命令使配置生效/sbin/sysctl p 创建 www 用户和组,虚拟主机使用的目录:/usr/sbin/groupadd www /usr/sbin/useradd -g www www mkdir -p /var/www chmod 750 /var/www chown -R www:www /var/www 创建 php-fpm 配置文件 ( php-fpm 是为 PHP 打的一个FastCGI 管理补丁, 可以平滑变更 php.ini 配置而无需重启php-cgi) :在/usr/local/php/etc/ 目录中创建php-fpm.conf 文件:rm -f /usr/local/php/etc/php-fpm.conf vi /usr/local/php/etc/php-fpm.conf 输 入以下内容(如果您安装Nginx + PHP 用于程序调试,请将以下的0 改为 1,以便显示 PHP 错误信息,否则,Nginx 会报状态为500 的空白错误页) : All relative paths in this config are relative to phps install prefix Pid file /usr/local/php/logs/php-fpm.pid Error log file /usr/local/php/logs/php-fpm.log Log level notice When this amount of php processes exited with SIGSEGV or SIGBUS . 10 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 10 页,共 25 页 - - - - - - - - - Linux Wap Game 服务器安装与配置11 . in a less than this interval of time, a graceful restart will be initiated. Useful to work around accidental curruptions in accelerators shared memory. 1m Time limit on waiting childs reaction on signals from master 5s Set to no to debug fpm yes Name of pool. Used in logs and stats. default Address to accept fastcgi requests on. Valid syntax is ip.ad.re.ss:port or just port or /path/to/unix/socket 127.0.0.1:9000 Set listen(2) backlog -1 Set permissions for unix socket, if one used. In Linux read/write permissions must be set in order to allow connections from web server. Many BSD-derrived systems allow connections regardless of permissions. 0666 Additional php.ini defines, specific to this pool of workers. /usr/sbin/sendmail -t -i 1 Unix user of processes 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 11 页,共 25 页 - - - - - - - - - Linux Wap Game 服务器安装与配置12 www Unix group of processes www Process manager settings Sets style of controling worker process count. Valid values are static and apache-like static Sets the limit on the number of simultaneous requests that will be served. Equivalent to Apache MaxClients directive. Equivalent to PHP_FCGI_CHILDREN environment in original php.fcgi Used with any pm_style. 128 Settings group for apache-like pm style Sets the number of server processes created on startup. Used only when apache-like pm_style is selected 20 Sets the desired minimum number of idle server processes. Used only when apache-like pm_style is selected 5 Sets the desired maximum number of idle server processes. Used only when apache-like pm_style is selected 35 The timeout (in seconds) for serving a single request after which the worker process will be terminated Should be used when max_execution_time ini option does not stop script execution for some reason 0s means off 0s 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 12 页,共 25 页 - - - - - - - - - Linux Wap Game 服务器安装与配置13 The timeout (in seconds) for serving of single request after which a php backtrace will be dumped to slow.log file 0s means off 0s The log file for slow requests logs/slow.log Set open file desc rlimit 51200 Set max core size rlimit 0 Chroot to this directory at the start, absolute path Chdir to this directory at the start, absolute path Redirect workers stdout and stderr into main error log. If not set, they will be redirected to /dev/null, according to FastCGI specs yes How much requests each process should execute before respawn. Useful to work around memory leaks in 3rd party libraries. For endless request processing please specify 0 Equivalent to PHP_FCGI_MAX_REQUESTS 500 Comma separated list of ipv4 addresses of FastCGI clients that allowed to connect. Equivalent to FCGI_WEB_SERVER_ADDRS environment in original php.fcgi (5.2.2+) Makes sense only with AF_INET listening socket. 127.0.0.1 Pass environment variables like LD_LIBRARY_PATH All $V ARIABLEs are taken from current environment $HOSTNAME /usr/local/bin:/usr/bin:/bin /tmp /tmp /tmp 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 13 页,共 25 页 - - - - - - - - - Linux Wap Game 服务器安装与配置14 $OSTYPE $MACHTYPE 2 启动 php-cgi 进程,监听127.0.0.1 的 9000 端口,进程数为200(如果服务器内存小于 3GB,可以只开启64 个进程),用户为www ulimit -SHn 51200 /usr/local/php/sbin/php-fpm start 设置开机自动启动:修改 /etc/rc.local 添加:ulimit -SHn 51200 /usr/local/php/sbin/php-fpm start 2、配置 php.ini在 php.ini 中修改:short_open_tag = On 另外,如果你的PHP 程序无法上传文件(头像),请:1.修改 php.ini: uplo