主要参考文章:

http://blog.csdn.net/forestarmy

http://blog.chinaunix.net/space.php?uid=25153965&do=blog&id=160561

1、安装OpenSUSE 11.4

2、打开防火墙的一些端口,以使能SSH等:

  1. # vi /ete/sysconfig/Susefirewall2 
  2. FW_SERVICES_EXT_TCP="ssh 445 139 389 telnet 80 81 82 " 
  3. FW_SERVICES_EXT_UDP="137 138 " 
  4. # rcSuSEfirewall2 restart 

3、搭建OBS

obs(opensuse build system)是meego源码编译的重要工具,也可以说是必备工具,有了它我们可以方便的对源码中各个包进行编译,进而做出meego镜像,所以搭建一个自己的obs系统是meego开发的重要部分。

  1. cd /etc/zypp/repos.d/;  
  2. wget http://download.opensuse.org/repositories/openSUSE:/Tools/openSUSE_11.4/openSUSE:Tools.repo 
  3. zypper ref 

安装obs-server和相关的包

  1. zypper in obs-server obs-signd obs-utils createrepo nfs-client obs-api memcached lighttpd 

设置数据库

默认开机开启:

  1. chkconfig --add mysql  
  2. 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。


使用系统提供的工具安装数据库:

  1. /usr/bin/mysql_secure_installation 

在这里可以输入自己数据库密码,默认是空的

创建数据库:

  1. mysql -u root -p  
  2. mysql> create database api_production;  
  3. mysql> create database webui_production; 

将obs的用户信息加到数据库中:

  1. GRANT all privileges  
  2. ON api_production.*  
  3. TO 'obs'@'%', 'obs'@'localhost' IDENTIFIED BY 'obspasswd';  
  4. GRANT all privileges  
  5. ON webui_production.*  
  6. TO 'obs'@'%', 'obs'@'localhost' IDENTIFIED BY 'obspasswd';  
  7. FLUSH PRIVILEGES; 

在这里设置obs的密码:obspasswd

为了使用数据库,需要配置OBS:

  1. vi /srv/www/obs/api/config/database.yml  
  2. #change the production section  
  3. production:  
  4. adapter: mysql  
  5. database: api_production  
  6. username: obs  
  7. password: obspasswd 
  1. vi /srv/www/obs/webui/config/database.yml  
  2. #change the production section  
  3. production:  
  4. adapter: mysql  
  5. database: webui_production  
  6. username: obs  
  7. password: obspasswd 

填充数据库:

  1. cd /srv/www/obs/api/  
  2. RAILS_ENV="production" rake db:setup  
  3.  
  4. cd /srv/www/obs/webui/  
  5. RAILS_ENV="production" rake db:setup 

设置lighttpd

  1. 网页形式显现出来
    1. # vi /etc/lighttpd/lighttpd.conf  
    2. include_shell "cat /etc/lighttpd/vhosts.d/*.conf"  
    3. vi /etc/lighttpd/vhosts.d/obs.conf 
    4. $SERVER["socket"] == ":80" { 
    5. rails_app = "webui" 
    6. rails_root = "/srv/www/obs/webui" 
    7. rails_procs = 3 
    8. # production/development are typical values here 
    9. rails_mode = "production" 
    10. log_root = "/srv/www/obs/webui/log" 
    11. include "vhosts.d/rails.inc" 
    12. $SERVER["socket"] == ":81" { 
    13. rails_app = "api" 
    14. rails_root = "/srv/www/obs/api" 
    15. rails_procs = 3 
    16. # production/development are typical values here 
    17. rails_mode = "production" 
    18. log_root = "/srv/www/obs/api/log" 
    19.  
    20. include "vhosts.d/rails.inc" 
    21. $SERVER["socket"] == ":82" { 
    22. server.name = "192.168.129.140" # IP地址改成自己服务器的地址,比如“192.168.129.140” 
    23. server.document-root = "/srv/obs/repos/" 
    24. dir-listing.activate = "enable" 
    25. }  
    1. # vi /etc/lighttpd/modules.conf 
    2. server.modules = ( 
    3. "mod_access", 
    4. # "mod_alias", 
    5. # "mod_auth", 
    6. # "mod_evasive", 
    7. # "mod_redirect", 
    8. "mod_rewrite", 
    9. # "mod_setenv", 
    10. # "mod_usertrack", 
    11.  
    12. ## 
    13. ## mod_magnet 
    14. ## 
    15. include "conf.d/magnet.conf" 
    16.  
    17. ## 
    18. ## FastCGI (mod_fastcgi) 
    19. ## 
    20. include "conf.d/fastcgi.conf" 
  1. # vi /srv/www/obs/webui/config/environments/production.rb  
  2. FRONTEND_HOST = "192.168.129.140"  
  3. FRONTEND_PORT = 81  
  4. FRONTEND_PROTOCOL = 'http'  
  5. BUGZILLA_HOST = nil  
  6. DOWNLOAD_URL = "http://192.168.129.140:82"  
  7. ICHAIN_MODE = "off"  
  8. BASE_NAMESPACE = nil  
  9. # vi /srv/www/obs/api/config/environments/production.rb 
  10. SOURCE_HOST = "192.168.129.140" 

相关文章: