suse 11 SP1 安装gitlab(未完,待续)

7 篇文章 0 订阅
1 篇文章 0 订阅

参考

https://github.com/gitlabhq/gitlabhq/blob/master/README.md

https://github.com/n3rdbeere/Installation-guide-for-GitLab6-on-SLES11/blob/master/README.md


GitLab requires the following software:
Ubuntu/Debian/CentOS/RHEL
Ruby (MRI) 2.0 or 2.1
Git 1.7.10+
Redis 2.0+
MySQL or PostgreSQL
Install needed Packages and Dependencies
run as root
zypper clean && zypper refresh
zypper install --type pattern Basis-Devel
zypper install sudo vim vim-data ctags postfix python ntp


zypper in mysql   
zypper rm  ruby
zypper in curl  findutils-locate
先安装依赖包:
rpm -ivh zlib-devel-1.2.3-106.34.x86_64.rpm
rpm -ivh readline-devel-5.2-147.9.13.x86_64.rpm
rpm -ivh libxml2-devel-2.7.6-0.1.37.x86_64.rpm
rpm -ivh libopenssl-devel-0.9.8h-30.27.11.x86_64.rpm 
rpm -ivh libgpg-error-devel-1.6-8.6.x86_64.rpm


Create a group and a user 'gitlab'
groupadd gitlab
useradd gitlab -m -d /home/gitlab -s /bin/bash -g gitlab
passwd gitlab


Install libicu and libicu-devel, version > 4.2 is necessary!
rpm -ivh libicu-4.4.2-3.1.x86_64.rpm
rpm -ivh libicu-devel-4.4.2-3.1.x86_64.rpm


在安装ruby之前,必须先安装相关的依赖包
Build Ruby 2, this version is not in the official repos
mkdir tmp_inst; cd !$
wget ftp://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p247.tar.gz
tar xfvz ruby-2.0.0-p247.tar.gz
cd ruby-2.0.0-p247


        This will take some time


./configure && make && make install


link ruby to /usr/bin/ruby
ln -s /usr/local/bin/ruby /usr/bin/ruby
build libxslt from hand:


wget ftp://xmlsoft.org/libxml2/libxslt-1.1.28.tar.gz
tar xfvz libxslt-1.1.28.tar.gz
cd libxslt-1.1.28/
./configure --prefix=/usr
make && make install


build openssl extension for ruby


cd ruby-2.0.0-p247/ext/openssl
ruby extconf.rb
make && make install
ln -s /usr/local/bin/gem /usr/bin/gem
gem update --system
(如果出现这个错误:
gem update --systemERROR:  Loading command: update (LoadError)
cannot load such file -- zlib
ERROR:  While executing gem ... (NoMethodError)
    undefined method `invoke_with_build_args' for nil:NilClass
解决办法:
cd /ruby-source-files/ext/zlib
ruby extconf.rb
make
sudo make install

gem install -l bundler-1.8.1.gem


Build needed gems:
gem install -l charlock_holmes-0.7.3.gem 
gem install -l mini_portile-0.6.0.gem
gem install -l nokogiri-1.6.6.2.gem
Install and configure redis
wget http://download.redis.io/releases/redis-2.6.16.tar.gz
tar xfvz redis-2.6.16.tar.gz
cd redis-2.6.16
make
[maek install]自己加的
edit /etc/sysctl.conf and insert
        vm.overcommit_memory = 1


mv redis-2.6.16 /opt/redis
link redis binaries to to /usr/bin 如下
ln -s /opt/redis/src/redis-cli /usr/bin/redis-cli
ln -s /opt/redis/src/redis-server /usr/bin/redis-server


Install git(Git 1.7.10++
Install and configure Gitlab-Shell
cd /home/gitlab
su gitlab
git config --global http.sslVerify false
git clone https://github.com/gitlabhq/gitlab-shell.git
cd /home/gitlab/gitlab-shell
git checkout version-1-9
cp config.yml.example config.yml
edit config and replace github url, if necessary
config.yml修改情况如下
2c2
< user: git
---
> user: gitlab
22c22
< repos_path: "/home/git/repositories"
---
> repos_path: "/home/gitlab/repositories"
25c25
< auth_file: "/home/git/.ssh/authorized_keys"
---
> auth_file: "/home/gitlab/.ssh/authorized_keys"


setup gitlab shell:
./bin/install
exit (change back to admin user)
Database Setup (MySQL)
This section is taken from official Gitlab Documentation.
先启动下Mysql
/etc/init.d/mysql start
Secure your installation.
mysql_secure_installation
修改默认密码
Set root password? [Y/n] y
New password: mysql
Re-enter new password:mysql 


Login to MySQL
mysql -u root -p
Type the database root password
Create a user for GitLab do not type the 'mysql>', this is part of the prompt change $password in the command below to a real password you pick
mysql> CREATE USER 'gitlab'@'localhost' IDENTIFIED BY '$password';
Create the GitLab production database
mysql> CREATE DATABASE IF NOT EXISTS `gitlabhq_production` DEFAULT CHARACTER SET `utf8` COLLATE `utf8_unicode_ci`;
Grant the GitLab user necessary permissions on the table.
mysql> GRANT SELECT, LOCK TABLES, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER ON `gitlabhq_production`.* TO 'gitlab'@'localhost';
Quit the database session
mysql> \q
Try connecting to the new database with the new user
sudo -u gitlab -H mysql -u gitlab -p -D gitlabhq_production
Type the password you replaced $password with earlier
You should now see a 'mysql>' prompt
Quit the database session
mysql> \q
You are done installing the database and can go back to the rest of the installation.
Checkout Gitlab and create needed directories
as user gitlab:
git clone https://github.com/gitlabhq/gitlabhq.git gitlab
cd /home/gitlab/gitlab
git checkout 7-7-stable


cp config/gitlab.yml.example config/gitlab.yml
change localhost to fully qualified domain name in gitlab.yaml
make sure gitlab can read/write in in/to log and tmp dirs
as root:
chown -R gitlab log/
chown -R gitlab tmp/
chmod -R u+rwX  log/
chmod -R u+rwX  tmp/
as gitlab:
mkdir /home/gitlab/gitlab-satellites
Create directories for sockets/pids and make sure GitLab can write to them
sudo -u gitlab -H mkdir tmp/pids/
sudo -u gitlab -H mkdir tmp/sockets/
sudo chmod -R u+rwX  tmp/pids/
sudo chmod -R u+rwX  tmp/sockets/
Enable cluster mode if you expect to have a high load instance Ex. change amount of workers to 3 for 2GB RAM server
sudo -u git -H editor config/unicorn.rb
(has been set to 5)
Configure git
Configure Git global settings for git user, useful when editing via web Edit user.email according to what is set in gitlab.yml
sudo -u gitlab -H git config --global user.name "GitLab"
sudo -u gitlab -H git config --global user.email "gitlab@localhost"
sudo -u gitlab -H git config --global core.autocrlf input
Configure Database
as git:
cd /home/gitlab/gitlab/config
cp config/database.yml.mysql config/database.yml
put login and password for database to
gitlab/config/database.yml
and change root to gitlab
 Update username/password in config/database.yml.
 You only need to adapt the production settings (first part).
11,12c11,12
<   username: root
<   password: mysql
---
>   username: git
>   password: "secure password"
Make config/database.yml readable to git only
sudo -u gitlab -H chmod o-rwx config/database.yml


Now install all other needed gems.
Note it says: without ... postgres(if you use MySQL (note, the option says "without ... postgres"))
as gitlab user
Rails 3 中引入Bundle来管理项目中所有gem依赖,该命令只能在一个含有Gemfile的目录下执行
gitlab@emal:~/gitlab> bundle install --deployment --without development test postgres aws
Fetching gem metadata from https://rubygems.org/.......
Fetching version metadata from https://rubygems.org/...
Fetching dependency metadata from https://rubygems.org/..
Using rake 10.3.2
Using RedCloth 4.2.9
Using ace-rails-ap 2.0.1
Using i18n 0.6.11
Installing json 1.8.1
Installing minitest 5.3.5
Installing thread_safe 0.3.4
Installing tzinfo 1.2.2
Installing activesupport 4.1.1
Installing builder 3.2.2
Installing erubis 2.7.0
Installing actionview 4.1.1
Installing rack 1.5.2
Installing rack-test 0.6.2
Installing actionpack 4.1.1
Installing mime-types 1.25.1
Installing polyglot 0.3.4
Installing treetop 1.4.15
Installing mail 2.5.4
Installing actionmailer 4.1.1
Installing activemodel 4.1.1
Installing arel 5.0.1.20140414130214
Installing activerecord 4.1.1
Using bundler 1.8.1
Installing thor 0.19.1
Installing railties 4.1.1
Installing hike 1.2.3
Installing multi_json 1.10.1
Installing tilt 1.4.1
Installing sprockets 2.11.0
Installing sprockets-rails 2.1.3


NoMethodError: undefined method `size' for nil:NilClass
An error occurred while installing rails (4.1.1), and Bundler cannot continue.
Make sure that `gem install rails -v '4.1.1'` succeeds before bundling.


gem install -l rails-4.1.1.gem


as root:
gem install -l json-1.8.1.gem




start redis as daemon via
redis-server &
Set up Gitlab
Execute Setup for Gitlab
sudo -u gitlab -H bundle exec rake gitlab:setup RAILS_ENV=production
type yes, if everything went fine, output shall be:
[..] Administrator account created:
login.........admin@local.host password......5iveL!fe
Copy binaries to init.d
sudo cp lib/support/init.d/gitlab /etc/init.d/gitlab
sudo chmod +x /etc/init.d/gitlab
and make Gitlab start on boot
chkconfig -add gitlab
check application status
as git
bundle exec rake gitlab:env:info RAILS_ENV=production
Sample Output:
System information
System:     SUSE LINUX 11
Current User:   git
Using RVM:  no
Ruby Version:   2.0.0p247
Gem Version:    2.1.5
Bundler Version:1.3.5
Rake Version:   10.1.0


GitLab information
Version:    6.1.0
Revision:   b595503
Directory:  /home/git/gitlab
DB Adapter: mysql2
URL:        http://localhost
HTTP Clone URL: http://localhost/some-project.git
SSH Clone URL:  git@localhost:some-project.git
Using LDAP: no
Using Omniauth: no


GitLab Shell
Version:    1.7.1
Repositories:   /home/git/repositories/
Hooks:      /home/git/gitlab-shell/hooks/
Git:        /usr/bin/git
as root start gitlab
/etc/init.d/gitlab restart
Sample output:
Starting the GitLab Unicorn web server...
Starting the GitLab Sidekiq event dispatcher...
The GitLab Unicorn webserver with pid 30332 is running.
The GitLab Sidekiq job dispatcher with pid 30358 is running.
GitLab and all it's components are up and running.
double check environment
as git
bundle exec rake gitlab:check RAILS_ENV=production
if everything is green -> everything went fine
Sample output:
$> time bundle exec rake gitlab:check RAILS_ENV=production
Checking Environment ...


Git configured for git user? ... yes
Has python2? ... yes
python2 is supported version? ... yes


Checking Environment ... Finished


Checking GitLab Shell ...


GitLab Shell version >= 1.7.1 ? ... OK (1.7.1)
Repo base directory exists? ... yes
Repo base directory is a symlink? ... no
Repo base owned by git:git? ... yes
Repo base access is drwxrws---? ... yes
update hook up-to-date? ... yes
update hooks in repos are links: ... can't check, you have no projects


Checking GitLab Shell ... Finished


Checking Sidekiq ...


Running? ... yes


Checking Sidekiq ... Finished


Checking GitLab ...


Database config exists? ... yes
Database is SQLite ... no
All migrations up? ... yes
GitLab config exists? ... yes
GitLab config outdated? ... no
Log directory writable? ... yes
Tmp directory writable? ... yes
Init script exists? ... yes
Init script up-to-date? ... yes
projects have namespace: ... can't check, you have no projects
Projects have satellites? ... can't check, you have no projects
Redis version >= 2.0.0? ... yes
Your git bin path is "/usr/bin/git"
Git version >= 1.7.10 ? ... yes (1.7.12)


Checking GitLab ... Finished




real    0m16.666s
user    0m14.009s
sys 0m2.128s
NGINX
install not from repo as this version is too old
wget http://download.opensuse.org/repositories/home:/itcrow:/branches:/home:/emendonca/SLE_11_SP2/x86_64/nginx-1.2.3-12.1.x86_64.rpm
rpm -i nginx-1.2.3-12.1.x86_64.rpm


cd /etc/nginx
mkdir sites-available
mkdir sites-enabled
add folger 'sites-enabled' to http-section in nginx.conf
http {
    include       mime.types;
    default_type  application/octet-stream;


    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
    #                  '$status $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';


    #access_log  logs/access.log  main;


    sendfile        on;
    #tcp_nopush     on;


    #keepalive_timeout  0;
    keepalive_timeout  65;
-->    include /etc/nginx/sites-enabled/*; <---
    #gzip  on;


    server {
        listen
                [..]
copy gitlab-webdirectory to nginx and link it to the sites-enabled directory
cd /home/git/gitlab
sudo cp lib/support/nginx/gitlab /etc/nginx/sites-available/gitlab
sudo ln -s /etc/nginx/sites-available/gitlab /etc/nginx/sites-enabled/gitlab
replace default nginx user by user git and group root, in /etc/nginx/nginx.conf
#user nginx:
user git root;
Restart nginx
sudo /etc/init.d/nginx restart

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值