主要参考文章:
http://blog.csdn.net/forestarmy
http://blog.chinaunix.net/space.php?uid=25153965&do=blog&id=160561
1、安装OpenSUSE 11.4
2、打开防火墙的一些端口,以使能SSH等:
- # vi /ete/sysconfig/Susefirewall2
- FW_SERVICES_EXT_TCP="ssh 445 139 389 telnet 80 81 82 "
- FW_SERVICES_EXT_UDP="137 138 "
- # rcSuSEfirewall2 restart
3、搭建OBS
obs(opensuse build system)是meego源码编译的重要工具,也可以说是必备工具,有了它我们可以方便的对源码中各个包进行编译,进而做出meego镜像,所以搭建一个自己的obs系统是meego开发的重要部分。
- cd /etc/zypp/repos.d/;
- wget http://download.opensuse.org/repositories/openSUSE:/Tools/openSUSE_11.4/openSUSE:Tools.repo
- zypper ref
安装obs-server和相关的包
- zypper in obs-server obs-signd obs-utils createrepo nfs-client obs-api memcached lighttpd
设置数据库
默认开机开启:
- chkconfig --add mysql
- rcmysql start
注意,chkconfig --add mysql可能会失败:
linux-ubai:/obs # chkconfig --level 35 mysql on
insserv: FATAL: service network is missed in the runlevels 2 to use service mysql
insserv: exiting now!
/sbin/insserv failed, exit code 1
解决办法是,将"network"的level2打开:chkconfig --level 2 network on。
使用系统提供的工具安装数据库:
- /usr/bin/mysql_secure_installation
在这里可以输入自己数据库密码,默认是空的
创建数据库:
- mysql -u root -p
- mysql> create database api_production;
- mysql> create database webui_production;
将obs的用户信息加到数据库中:
- GRANT all privileges
- ON api_production.*
- TO 'obs'@'%', 'obs'@'localhost' IDENTIFIED BY 'obspasswd';
- GRANT all privileges
- ON webui_production.*
- TO 'obs'@'%', 'obs'@'localhost' IDENTIFIED BY 'obspasswd';
- FLUSH PRIVILEGES;
在这里设置obs的密码:obspasswd
为了使用数据库,需要配置OBS:
- vi /srv/www/obs/api/config/database.yml
- #change the production section
- production:
- adapter: mysql
- database: api_production
- username: obs
- password: obspasswd
- vi /srv/www/obs/webui/config/database.yml
- #change the production section
- production:
- adapter: mysql
- database: webui_production
- username: obs
- password: obspasswd
填充数据库:
- cd /srv/www/obs/api/
- RAILS_ENV="production" rake db:setup
- cd /srv/www/obs/webui/
- RAILS_ENV="production" rake db:setup
设置lighttpd
- 网页形式显现出来
-
- # vi /etc/lighttpd/lighttpd.conf
- include_shell "cat /etc/lighttpd/vhosts.d/*.conf"
- vi /etc/lighttpd/vhosts.d/obs.conf
- $SERVER["socket"] == ":80" {
- rails_app = "webui"
- rails_root = "/srv/www/obs/webui"
- rails_procs = 3
- # production/development are typical values here
- rails_mode = "production"
- log_root = "/srv/www/obs/webui/log"
- include "vhosts.d/rails.inc"
- }
- $SERVER["socket"] == ":81" {
- rails_app = "api"
- rails_root = "/srv/www/obs/api"
- rails_procs = 3
- # production/development are typical values here
- rails_mode = "production"
- log_root = "/srv/www/obs/api/log"
- include "vhosts.d/rails.inc"
- }
- $SERVER["socket"] == ":82" {
- server.name = "192.168.129.140" # IP地址改成自己服务器的地址,比如“192.168.129.140”
- server.document-root = "/srv/obs/repos/"
- dir-listing.activate = "enable"
- }
-
- # vi /etc/lighttpd/modules.conf
- server.modules = (
- "mod_access",
- # "mod_alias",
- # "mod_auth",
- # "mod_evasive",
- # "mod_redirect",
- "mod_rewrite",
- # "mod_setenv",
- # "mod_usertrack",
- )
- ##
- ## mod_magnet
- ##
- include "conf.d/magnet.conf"
- ##
- ## FastCGI (mod_fastcgi)
- ##
- include "conf.d/fastcgi.conf"
- # vi /srv/www/obs/webui/config/environments/production.rb
- FRONTEND_HOST = "192.168.129.140"
- FRONTEND_PORT = 81
- FRONTEND_PROTOCOL = 'http'
- BUGZILLA_HOST = nil
- DOWNLOAD_URL = "http://192.168.129.140:82"
- ICHAIN_MODE = "off"
- BASE_NAMESPACE = nil
- # vi /srv/www/obs/api/config/environments/production.rb
- SOURCE_HOST = "192.168.129.140"