2014年6月11日 星期三

CentOS 文字模式安裝

參考來源:
http://www.cmarket.tw/yjhwang/linux?n=convew&i=4363
http://blog.xuite.net/itwiz/learning/58011669

【文字模式安裝CentOS 6.5】
在CentOS的開安歡迎畫面選擇Install or upgrade an existing後,按TAB鍵在選單下方會出現
vmlinuz initrd=initrd.img
在字串後方加上 linux text按enter開始,簡單的選擇語系、鍵盤、時區、root密碼後就一路自動跑下到結束。

在安裝CentOS 6.5 之後,輸入 setup 出現
 setup: command not found

解決方式如下:
yum –y install setuptool

另外還可安裝其它管理工具,所有清單可以參考http://mirror.centos.org/centos/6/os/i386/Packages/

先安裝一些常用的部份
yum –y install system-config-firewall-tui
yum –y install system-config-network-tui
yum –y install system-config-securitylevel-tui
yum –y install ntsysv

※在CentOS 6.6版,firewall的選單卻無法執行,會出現錯誤訊息
# system-config-firewall-tui 
Traceback (most recent call last):
  File "/usr/bin/system-config-firewall-tui", line 29, in <module>
    import fw_tui
  File "/usr/share/system-config-firewall/fw_tui.py", line 34, in <module>
    import fw_nm
ImportError: No module named fw_nm

這裏有說明Bug 1123919,解決的方法就是另外安裝dbus 和 dbus-python 兩個套件,然後shutdown -r now,重新登入後就解決了。

安裝uWSGI配合Nginx Server

【安裝uwsgi】

參考:http://www.openfoundry.org/tw/tech-column/8536-introduction-of-python-extension-management-tools

先安裝 pip 套件管理程式
easy_install pip

參考:https://docs.djangoproject.com/en/dev/howto/deployment/wsgi/uwsgi/
安裝gcc
yum install gcc

安裝
yum install python-devel

安裝目前stable版的uwsgi
pip install uwsgi

參考文章:http://django-china.cn/topic/101/

測試安裝結果

測試一:直接執行uwsgi命令,不加任何參數
uwsgi

測試二:
新增測試檔案
cd /home/john/www/test.py

# test.py
def application(env, start_response):
    start_response('200 OK', [('Content-Type','text/html')])
    return "Hello World"

執行uwsgi伺服器
uwsgi --http :8001 --wsgi-file test.py

用瀏覽器開啟網頁
http://127.0.0.1:8001

成功的話,應該會出現
Hello World

2014年6月10日 星期二

CentOS安裝Django

參考文章:http://itekblog.com/django-centos-6-4/

因為安裝CentOS65時,使用Desktop方式安裝,所以系統中已經有python 2.6.6了
所以接著先安裝EPEL repositories

wget http://mirrors.nl.eu.kernel.org/fedora-epel/6/i386/epel-release-6-8.noarch.rpm
rpm -Uvh epel-release-6-8.noarch.rpm
rm epel-release-6-8.noarch.rpm -f

※另法
也可以先用wget下載,安裝https://pypi.python.org/pypi/distribute 套件。

安裝Django
yum install python-setuptools
easy_install django

或者改用pip方式裝,可指定安裝的版本
pip install Django==1.6.5

測試Django

import django
print django.get_version()

測試開發Django網站
cd ~
django-admin.py startproject testdjangosite
cd testdjangosite
python manage.py runserver

用瀏覽器開啟 http://127.0.0.1:8000/


2014年6月9日 星期一

在CentOS 6 上安裝nginx server

■資料來源:
http://wiki.nginx.org/Install
http://nginx.org/en/linux_packages.html

■新增nginx yum repository,
新增檔案/etc/yum.repos.d/nginx.repo,內容如下:

[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/6/$basearch/
gpgcheck=0
enabled=1

記得確定版本

wget http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm
rpm -ivh http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm

■更新套件庫
yum update

■安裝 Nginx Web Server
yum install nginx

■執行 Nginx Web Server
service nginx start
Starting nginx:                                            [  OK  ]

■瀏覽一下


■設定開機預設啟動 Nginx 和關閉 Apache Web Server
chkconfig --level 3 nginx on
chkconfig --level 3 httpd off

■順便安裝webmin的管理模組
http://www.webmin.com/cgi-bin/search_third.cgi?search=nginx
登入webmin後,直接以網址方式安裝模組即可。



另一篇也不錯
http://www.cyberciti.biz/faq/install-nginx-centos-rhel-6-server-rpm-using-yum-command/

2012年10月17日 星期三

vmdk轉vdi

直接利用VirtualBox附的VBoxManage就可以轉換虛擬硬碟的格式。 指令:
VBoxManage clonehd source.vmdk target.vdi --format VDI
--format是指target的格式