Commit 8f3adf9f authored by randx's avatar randx Committed by Dmitriy Zaporozhets

Improved installation manual

parent b6628b4a
......@@ -30,14 +30,6 @@ We recommend to use server with at least 1GB RAM for gitlab instance.
## This installation guide created for Debian/Ubuntu and properly tested.
The installation consists of 6 steps:
1. Install packages / dependencies
2. Install ruby
3. Install Gitolite
4. Install and configure GitLab.
5. Start the web front-end
6. Start a Resque worker (for background processing)
### IMPORTANT
......@@ -47,6 +39,26 @@ Only create a GitHub Issue if you want a specific part of this installation guid
Also read the [Read this before you submit an issue](https://github.com/gitlabhq/gitlabhq/wiki/Read-this-before-you-submit-an-issue) wiki page.
# Basic setup
The basic installation will provide you a GitLab setup with options:
1. ruby 1.9.3
2. mysql as main db
3. gitolite v3 fork by gitlab
4. nginx + unicorn
The installation consists of next steps:
1. Install packages / dependencies
2. Install ruby
3. Install Gitolite
4. Install mysql and create db
5. Install and configure GitLab.
6. nginx + unicorn
7. service gitlab
> - - -
> The first 3 steps of this guide can be easily skipped by executing an install script:
>
......@@ -65,6 +77,7 @@ Also read the [Read this before you submit an issue](https://github.com/gitlabhq
> for more detailed instructions read the HOWTO section of [the script](https://github.com/gitlabhq/gitlab-recipes/blob/master/install/debian_ubuntu_aws.sh)
> - - -
# 1. Install packages
*Keep in mind that `sudo` is not installed on Debian by default. You should install it as root:*
......@@ -78,54 +91,6 @@ Now install the required packages:
sudo apt-get install -y wget curl gcc checkinstall libxml2-dev libxslt-dev libcurl4-openssl-dev libreadline6-dev libc6-dev libssl-dev libmysql++-dev make build-essential zlib1g-dev libicu-dev redis-server openssh-server git-core python-dev python-pip libyaml-dev postfix libpq-dev
# Database
## SQLite
sudo apt-get install -y sqlite3 libsqlite3-dev
## MySQL
sudo apt-get install -y mysql-server mysql-client libmysqlclient-dev
# Login to MySQL
$ mysql -u root -p
# Create the GitLab production database
mysql> CREATE DATABASE IF NOT EXISTS `gitlabhq_production` DEFAULT CHARACTER SET `utf8` COLLATE `utf8_unicode_ci`;
# Create the MySQL User change $password to a real password
mysql> CREATE USER 'gitlab'@'localhost' IDENTIFIED BY '$password';
# Grant proper permissions to the MySQL User
mysql> GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER ON `gitlabhq_production`.* TO 'gitlab'@'localhost';
## PostgreSQL
sudo apt-get install -y postgresql-9.2 postgresql-server-dev-9.2
# Connect to database server
sudo -u postgres psql -d template1
# Add a user called gitlab. Change $password to a real password
template1=# CREATE USER gitlab WITH PASSWORD '$password';
# Create the GitLab production database
template1=# CREATE DATABASE IF NOT EXISTS gitlabhq_production;
# Grant all privileges on database
template1=# GRANT ALL PRIVILEGES ON DATABASE gitlabhq_production to gitlab;
# Quit from PostgreSQL server
template1=# \q
# Try connect to new database
$ su - gitlab
$ psql -d gitlabhq_production -U gitlab
# 2. Install Ruby
wget http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p194.tar.gz
......@@ -201,7 +166,25 @@ Permissions:
Check the [Trouble Shooting Guide](https://github.com/gitlabhq/gitlab-public-wiki/wiki/Trouble-Shooting-Guide)
and ensure you have followed all of the above steps carefully.
# 4. Clone GitLab source and install prerequisites
# 4. Mysql database
sudo apt-get install -y mysql-server mysql-client libmysqlclient-dev
# Login to MySQL
$ mysql -u root -p
# Create the GitLab production database
mysql> CREATE DATABASE IF NOT EXISTS `gitlabhq_production` DEFAULT CHARACTER SET `utf8` COLLATE `utf8_unicode_ci`;
# Create the MySQL User change $password to a real password
mysql> CREATE USER 'gitlab'@'localhost' IDENTIFIED BY '$password';
# Grant proper permissions to the MySQL User
mysql> GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER ON `gitlabhq_production`.* TO 'gitlab'@'localhost';
# 5. Clone GitLab source and install prerequisites
sudo gem install charlock_holmes --version '0.6.8'
sudo pip install pygments
......@@ -220,30 +203,15 @@ and ensure you have followed all of the above steps carefully.
# Rename config files
sudo -u gitlab cp config/gitlab.yml.example config/gitlab.yml
#### Select the database you want to use
# SQLite
sudo -u gitlab cp config/database.yml.sqlite config/database.yml
# Mysql
sudo -u gitlab cp config/database.yml.mysql config/database.yml
# PostgreSQL
sudo -u gitlab cp config/database.yml.postgres config/database.yml
# Copy mysql db config
# make sure to update username/password in config/database.yml
sudo -u gitlab cp config/database.yml.mysql config/database.yml
#### Install gems
# mysql
sudo -u gitlab -H bundle install --without development test sqlite postgres --deployment
# or postgres
sudo -u gitlab -H bundle install --without development test sqlite mysql --deployment
# or sqlite
sudo -u gitlab -H bundle install --without development test mysql postgres --deployment
#### Setup database
sudo -u gitlab bundle exec rake gitlab:app:setup RAILS_ENV=production
......@@ -277,30 +245,57 @@ Checking status:
If you got all YES - congratulations! You can go to the next step.
# 5. Start the web server
# 6. nginx + unicorn
## 1. Unicorn
cd /home/gitlab/gitlab
sudo -u gitlab cp config/unicorn.rb.example config/unicorn.rb
## 2. Nginx
# Install first
sudo apt-get install nginx
# Add GitLab to nginx sites & change with your host specific settings
sudo wget https://raw.github.com/gitlabhq/gitlab-recipes/master/nginx/gitlab -P /etc/nginx/sites-available/
sudo ln -s /etc/nginx/sites-available/gitlab /etc/nginx/sites-enabled/gitlab
# Change **YOUR_SERVER_IP** and **YOUR_SERVER_FQDN**
# to the IP address and fully-qualified domain name
# of the host serving GitLab.
sudo vim /etc/nginx/sites-enabled/gitlab
# Restart nginx:
sudo /etc/init.d/nginx restart
Application can be started with next command:
# For test purposes
sudo -u gitlab bundle exec rails s -e production
# As daemon
sudo -u gitlab bundle exec rails s -e production -d
# 7. service gitlab
Create init script in /etc/init.d/gitlab:
sudo wget https://raw.github.com/gitlabhq/gitlab-recipes/master/init.d/gitlab -P /etc/init.d/
sudo chmod +x /etc/init.d/gitlab
GitLab autostart:
sudo update-rc.d gitlab defaults 21
Now you can start GitLab like:
sudo service gitlab start
You can login via web using admin generated with setup:
admin@local.host
5iveL!fe
# 6. Run Resque process (for processing job queue).
# Manually
sudo -u gitlab bundle exec rake environment resque:work QUEUE=* RAILS_ENV=production BACKGROUND=yes
# GitLab start script
sudo -u gitlab ./resque.sh
# if you run this as root /home/gitlab/gitlab/tmp/pids/resque_worker.pid will be owned by root
# causing the resque worker not to start via init script on next boot/service restart
# Advanced setup tips:
## Customizing Resque's Redis connection
......@@ -313,42 +308,75 @@ a different host, you can configure its connection string in the
**Ok - we have a working application now. **
**But keep going - there are some things that should be done **
# Nginx && Unicorn
## 1. Unicorn
# Database
cd /home/gitlab/gitlab
sudo -u gitlab cp config/unicorn.rb.example config/unicorn.rb
sudo -u gitlab bundle exec unicorn_rails -c config/unicorn.rb -E production -D
## SQLite
## 2. Nginx
sudo apt-get install -y sqlite3 libsqlite3-dev
# Install first
sudo apt-get install nginx
## MySQL
# Add GitLab to nginx sites & change with your host specific settings
sudo wget https://raw.github.com/gitlabhq/gitlab-recipes/master/nginx/gitlab -P /etc/nginx/sites-available/
sudo ln -s /etc/nginx/sites-available/gitlab /etc/nginx/sites-enabled/gitlab
sudo apt-get install -y mysql-server mysql-client libmysqlclient-dev
# Change **YOUR_SERVER_IP** and **YOUR_SERVER_FQDN**
# to the IP address and fully-qualified domain name
# of the host serving GitLab.
sudo vim /etc/nginx/sites-enabled/gitlab
# Login to MySQL
$ mysql -u root -p
# Restart nginx:
sudo /etc/init.d/nginx restart
# Create the GitLab production database
mysql> CREATE DATABASE IF NOT EXISTS `gitlabhq_production` DEFAULT CHARACTER SET `utf8` COLLATE `utf8_unicode_ci`;
## 3. Init script
# Create the MySQL User change $password to a real password
mysql> CREATE USER 'gitlab'@'localhost' IDENTIFIED BY '$password';
Create init script in /etc/init.d/gitlab:
# Grant proper permissions to the MySQL User
mysql> GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER ON `gitlabhq_production`.* TO 'gitlab'@'localhost';
sudo wget https://raw.github.com/gitlabhq/gitlab-recipes/master/init.d/gitlab -P /etc/init.d/
sudo chmod +x /etc/init.d/gitlab
GitLab autostart:
## PostgreSQL
sudo update-rc.d gitlab defaults 21
sudo apt-get install -y postgresql-9.2 postgresql-server-dev-9.2
# Connect to database server
sudo -u postgres psql -d template1
# Add a user called gitlab. Change $password to a real password
template1=# CREATE USER gitlab WITH PASSWORD '$password';
# Create the GitLab production database
template1=# CREATE DATABASE IF NOT EXISTS gitlabhq_production;
# Grant all privileges on database
template1=# GRANT ALL PRIVILEGES ON DATABASE gitlabhq_production to gitlab;
# Quit from PostgreSQL server
template1=# \q
# Try connect to new database
$ su - gitlab
$ psql -d gitlabhq_production -U gitlab
#### Select the database you want to use
# SQLite
sudo -u gitlab cp config/database.yml.sqlite config/database.yml
# Mysql
sudo -u gitlab cp config/database.yml.mysql config/database.yml
# PostgreSQL
sudo -u gitlab cp config/database.yml.postgres config/database.yml
Now you can start/restart/stop GitLab like:
# make sure to update username/password in config/database.yml
sudo /etc/init.d/gitlab restart
#### Install gems
# mysql
sudo -u gitlab -H bundle install --without development test sqlite postgres --deployment
# or postgres
sudo -u gitlab -H bundle install --without development test sqlite mysql --deployment
# or sqlite
sudo -u gitlab -H bundle install --without development test mysql postgres --deployment
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment