Fedora18 64bit nginx 安装iou-web的过程跟centos6.4 (x86_64bit)下几乎一样,由于iou-web默认安装运行在apache2.2下,而fedora18下默认apache2.4二者在配置文件语法上有些变化,所以默认yum安装的iou-web需要另外修改在apache2.4下的配置文件才能正常使用。刚好最近在弄nginx,所以尝试移植到nginx下,最终顺利运行,特做以下记录以享其他有类似困扰的兄弟。
这里所有的安装操作均在真机fedora 18下进行,不是虚拟机上。安装过程中会遇到这样那样的问题,不断地google,最后终于解决问题。另外我也在centos 6.4 64位上成功运行iou-web,跟这里步骤有些许不一样,稍后也放出安装具体过程。
以下是具体步骤:
1、创建iou-web的repo
touch /etc/yum.repos.d/iou-web.repo
# vi /etc/yum.repos.d/iou-web.repo
[iou-web]
name=IOU Web Interface
baseurl=http://public.routereflector.com/iou-web/yum
enabled=1
gpgcheck=1
gpgkey=http://public.routereflector.com/iou-web/yum/RPM-GPG-KEY-iou-web
Then install iou-web package:
# yum install iou-web
2 编辑/etc/sysconfig/selinux如下:
关闭selinux
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
#SELINUX=enforcing
SELINUX=disabled
# SELINUXTYPE= can take one of these two values:
# targeted - Targeted processes are protected,
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
3修改文件属性
使用下面的命令使nginx服务器有足够的权限使用IOU文件夹下的任何文件:
[root@iou ~]# cd /opt
[root@iou opt]# ls -l
total 12
drwx------ 7 root root 4096 Jun 3 10:17 iou
可以看到iou文件夹仅对root用户及root用户组能够有rwx的权限,其他用户和组没有任何权限,这里要添加权限。偷懒的办法就是不管什么用户和组都能对iou文件夹及所属文件进行任何操作。
那就是
[root@iou opt]#chmod 777 -R iou
[root@iou opt]# ls -l
drwxrwxrwx 7 root root 4096 Jun 3 10:17 iou
可以看到u g o都具备了读写执行的权限了。
当然,这里可以针对其他用户组赋予rwx权限:
[root@iou opt]# chmod o+rwx iou
[root@iou opt]# ls -l
drwx---rwx 7 root root 4096 Jun 3 10:17 iou //效果一样,反正是让其他用户组能rwx
不修改对文件夹的rwx权限的话,在nginx服务器下,在web浏览器下浏览会出现403 Forbiden的错误页面
4、然后使用下面的命令关闭iptables同时关闭开机自启:
# service iptables stop
# chkconfig iptables off
5、接下来是安装、配置、运行nginx
yum install nginx
Then we create the system startup links for nginx and start it:
systemctl enable nginx.service
systemctl start nginx.service
Type in your web server's IP address or hostname into a browser (e.g. http://127.0.0.1), and you should see the nginx welcome page:
6、安装 PHP5
yum install php-fpm php-cli php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc
php-magickwand php-mbstring php-mcrypt php-mssql php-shout php-snmp php-soap php-tidy
yum install php-pecl-apc
In order to avoid errors like为避免一些时区错误提示,php.ini中修改为正确的时区
[13-Nov011 22:13:16] PHP Warning: phpinfo(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Asian/Shanghai' for 'CET/1.0/no DST' instead in /usr/share/nginx/html/info.php on line 2
... in /var/log/php-fpm/www-error.log when you call a PHP script in your browser, you should open /etc/php.ini and set date.timezone:
vi /etc/php.ini
[...][Date]; Defines the default timezone used by the date functions; http://php.net/date.timezonedate.timezone = "Asia/Shanghai" [...] |
[root@server1 ~]#
Next create the system startup links for php-fpm and start it:
systemctl enable php-fpm.service
systemctl start php-fpm.service
PHP-FPM is a daemon process that runs a FastCGI server on port 9000.
187、配置 nginx
vi /etc/nginx/nginx.conf
[...]worker_processes 2; //CPU是几核就填几 [...] keepalive_timeout 2; //填合理些数值,否则就默认值 [...] |
vi /etc/nginx/nginx.conf
[...] server { listen 80; server_name localhost; #charset koi8-r; #access_log /var/log/nginx/host.access.log main; location / { root /opt/iou/html; //程序php所在的目录路径 index index.php index.html index.htm; //默认nginx执行的文件 } # redirect server error pages to the static page /40x.html # error_page 404 /404.html; location = /40x.html { root /usr/share/nginx/html; } # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root /opt/iou/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$ { root ; try_files $uri =404; fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $/opt/iou/html$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; } } [...]
注意:这里没有配置iou-web里面的log错误信息,所以导致页面上的download点击后无反应,
但是在/opt/iou/data/Log下使用cat命令查看相应的文件还是能看到错误日志信息的,
要配置错误信息可以参考/etc/httpd/conf.d/iou.conf里的错误信息
配置来修改nginx下的错误信息,不过iou.conf是apache下的
配置语法,跟nginx的配置语法不一样
Now save the file and reload nginx:
systemctl reload nginx.service
创建info.php,测试php是否正常运行
vi /usr/share/nginx/html/info.php
<?php phpinfo(); ?> |
地址栏输入访问info.php (e.g. http://127.0.0.1/info.php):
至此nginx下顺利运行php
浏览地址兰输入127.0.0.1,可以看到顺利运行iou-web的页面了。
8、
cd /opt/iou
chmod -R 777 bin
赋予bin目录下程序的执行权限
9、此时在bin目录下执行./I86BI_LINUX-ADVENTERPRISEK9-M-15.2.3
会提示没有 libcrypto.so.4的错误,由于iou-web是32位的软件,而系统装的是64位的centos6.4,默认程序到64位的lib64中查找 libcrypto.so.4,当然无法找到。当然,在lib下也没有libcrypto.so.4这个文件
如果不提示缺少 libcrypto.so.4的错误那就跳过步骤9、10
10、为解决 libcrypto.so.4,我安装openssl-devel.i686,注意:这里安装32位的openssl,所以要.i386,默认装的话会装x86_64的openssl
[root@iou lib]# yum install openssl-devel.i686
然后在/usr/lib下有libcrypto.so.10
11、创建软链接
[root@iou lib]# ln -s /usr/lib/libcrypto.so.10 /usr/lib/libcrypto.so.4
11、此时在bin目录下执行./I86BI_LINUX-ADVENTERPRISEK9-M-15.2.3已经正常
12、运行破解序列号的crack.py,该破解程序用google能搜索下载到,你懂的。
[root@iou bin]# ./crack.py
*********************************************************************
Cisco IOU License Generator - Kal 2011, python port of 2006 C version
hostid=00000000, hostname=iou.example.com, ioukey=5d4
Add the following text to ~/.iourc:
[license]
iou.example.com = f51c6440061fbd5b;
You can disable the phone home feature with something like:
echo '127.0.0.127 xml.cisco.com' >> /etc/hosts
千万注意license的生成跟hostname和机器的ip地址有关,只要二者改变任何一样就导致之前计算的license作废,需要重新生成
将生成序列号粘贴进/opt/bin/iourc下,此时再重新启动设备,一切就ok了,所有的设备终于变绿色了,可以敲实验了。
################################################################################