iou-web在fedora 18 (x86_64bit),ngix下安裝運行


     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

Nginx is available as a package for Fedora 18 which we can install as follows:

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了,所有的設備終於變綠色了,可以敲實驗了。

################################################################################


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章