meego obs 搭建全記錄

1Rpm包解包命令:rpm2cpio ../kernel-ntfs-2.4.20-8.i686.rpm | cpio –idmv

2http://wiki.meego.com/Build_Infrastructure/Sysadmin_Distro/OBS_setup_openSUSE112

Add Repositories

First, we have to add the openSUSE:Tools repository to zypper for qemu-svn and other updated tools.

     cd /etc/zypp/repos.d/;

     wget http://download.opensuse.org/repositories/openSUSE:/Tools/openSUSE_11.2/openSUSE:Tools.repo

     zypper ref

Accept the trust key.

Setup the Client

Install the Client Packages

§  For obs worker:

     zypper in obs-worker qemu-svn mount-static bash-static

Point To The Server

Edit the file /etc/sysconfig/obs-worker in order to point to correct repository server. (The example server is 192.168.1.1)

     # vi /etc/sysconfig/obs-worker

     OBS_SRC_SERVER="192.168.1.1:5352"

     OBS_REPO_SERVERS="192.168.1.1:5252"

Start the Client

Start the worker service

     chkconfig --add obsworker

     rcobsworker start

Setup the server

Install the Server packages

§  For server:

     zypper in obs-server obs-signer obs-utils createrepo nfs-client obs-api memcached lighttpd

MySQL Setup

Start daemon by default:

     chkconfig --add mysql

     rcmysql start

Secure the installation

     /usr/bin/mysql_secure_installation

Create the databases:

     mysql -u root -p

     mysql> create database api_production;

     mysql> create database webui_production;

Add the obs user for these databases (substitute the correct password in):

     GRANT all privileges

           ON api_production.*

           TO 'obs'@'%', 'obs'@'localhost' IDENTIFIED BY '************';

     GRANT all privileges

           ON webui_production.*

           TO 'obs'@'%', 'obs'@'localhost' IDENTIFIED BY '************';

     FLUSH PRIVILEGES;

 

自定義如下:

GRANT all privileges

          ON api_production.*

          TO 'obs'@'%', 'obs'@'localhost' IDENTIFIED BY '12345';

    GRANT all privileges

          ON webui_production.*

          TO 'obs'@'%', 'obs'@'localhost' IDENTIFIED BY '12345';

FLUSH PRIVILEGES;

 

Now, configure OBS to use MySQL, first the API server.

     vi /srv/www/obs/api/config/database.yml

     #change the production section

     production:

       adapter: mysql

       database: api_production

       username: obs

       password: ************

And setup the webui to use MySQL...

     vi /srv/www/obs/webui/config/database.yml

     #change the production section

     production:

       adapter: mysql

       database: webui_production

       username: obs

       password: ************

Populate the database

     cd /srv/www/obs/api/

     RAILS_ENV="production" rake db:migrate

 

     cd /srv/www/obs/webui/

     RAILS_ENV="production" rake db:migrate

If this fails, check /srv/www/obs/api/config/environments/production.rb and /srv/www/obs/webui/config/environments/production.rb for configuration of the SOURCE_HOST and FRONTEND_HOST.

Setup lighttpd for webui

Make sure vhosts are enabled by uncommenting the following line:

      # vi /etc/lighttpd/lighttpd.conf

      include_shell "cat /etc/lighttpd/vhosts.d/*.conf"

Setup the regular webui on 80, api on 81, and 82 is the repository.

      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.1.1"

        server.document-root = "/srv/obs/repos/"

        dir-listing.activate = "enable"

      }

lighttpd requires some extra modules to be enabled: mod_access, mod_rewrite, mod_magnet, and mod_fastcgi. Do so by editing /etc/lighttpd/modules.conf:

     # 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"

You need also to configure /srv/www/obs/webui/config/environments/production.rb to point to correct server names:

     # vi /srv/www/obs/webui/config/environments/production.rb

     FRONTEND_HOST = "192.168.1.1"

     FRONTEND_PORT = 81

     FRONTEND_PROTOCOL = 'http'

     BUGZILLA_HOST = nil

     DOWNLOAD_URL = "http://192.168.1.1:82"

     ICHAIN_MODE = "off"

     BASE_NAMESPACE = nil

Do the same for /srv/www/obs/api/config/environments/production.rb. As soon your backend is not on the same machine as the api (frontend), change the following:

     # vi /srv/www/obs/api/config/environments/production.rb

     SOURCE_HOST = "192.168.1.1"

Add the server to start by default.

     chkconfig --add memcached

     chkconfig --add lighttpd

     chkconfig --add obsapidelayed

     chkconfig --add obswebuidelayed

ligthttpd user and group need to be the onwer of api and webui dirs (as well as log and tmp):

     chown -R lighttpd.lighttpd /srv/www/obs/{api,webui}

BSConfig.pm

The file /usr/lib/obs/server/BSConfig.pm is used to configure several settings for the Build Service. One of the major components is setting up the $hostname variable to the correct value. Currently I have this set to the IP address of the server.

      my $hostname = '192.168.1.1';

The list of directories in /srv/obs/repos/ is the repositories, so I changed the $repodownload:

      our $repodownload = "http://$hostname:82/";

Verification

At this point you should be able to open a browser and go to your server and login to OBS. Port 80 should be the webui, port 81 should be the api, and port 82 should be the repository directory. The default username/password is Admin/opensuse.

Start By Default

The OBS should start automatically, so they should be added to chkconfig to do so:

      chkconfig --add obsrepserver obssrcserver obsscheduler obsdispatcher obspublisher obswarden obssigner

Setting up Cross Compile

Configure build types

To setup cross compile, add the appropriate machine types to /etc/sysconfig/obs-server. For example, the following will enable ARM builds.

      # vi /etc/sysconfig/obs-server

      OBS_SCHEDULER_ARCHITECTURES="i586 armv5el armv7el“

 

  rcmysql start

  rcobsrepserver start

  rcobssrcserver start

  rcobsscheduler start

  rcobsworker start

  rcobsdispatcher start

  rcobspublisher  start

  rclighttpd start

 

 

3、接下來要 zypper    in    qemu      因爲要交叉編譯 armv7el

   https://bugzilla.novell.com/show_bug.cgi?id=574654#c1  另外由於這個bug的原因,要升級內核

http://download.opensuse.org/repositories/Kernel:/openSUSE-11.2/openSUSE_11.2/i586/

   kernel-desktop-2.6.31.14-23.1.i586.rpm 

然後rpm    -ivh 安裝 重啓

每次開機 檢查

查看 cat /proc/sys/vm/mmap_min_addr

在主機(不是scratchbox下阿)上運行命令:

 sudo sysctl -w vm.mmap_min_addr=0

 

 

 

4、然後使用腳本 + 壓縮包裏面的trunk  prj.conf 就可以構建repository target

/srv/obs/build/name/standard下面刪掉 target 

 

在這之前記得 /etc/sysconfig/obs-server  中把armv7elarchitecture開起來

                  /etc/sysconfig/obs-worker  worker設置成1個就可以了

Ln –s  /obs/…../i586    /srv/obs/build/name/standard/i586  建立軟連接即可

Ln  -s /obs/……./armv7el  /srv/obs/build/name/standard/armv7el

 

5、接下來就好了,就可以選擇arch 什麼的進行編譯src.rpm

 

 

 

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