1. System Environment
[Email protected]: ~ $ CAT/etc/issue
Ubuntu 12.04.4 lts \ n \ L
[Email protected]: ~ $ Uname-ra
Linux mode 3.11.0-15-generic #25 ~ Precise1-Ubuntu SMP Thu Jan 30 17:39:31 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
2. Create a user
[Email protected]: ~ $ Sudo adduser deploy
[Sudo] password for Jim:
Perl: Warning: Setting locale failed.
Perl: Warning: Please check that your locale settings:
Language = "zh_cn: ZH ",
Lc_all = (unset ),
Lc_paper = "zh_cn ",
Lc_address = "zh_cn ",
Lc_monetary = "zh_cn ",
Lc_numeric = "zh_cn ",
Lc_telephone = "zh_cn ",
Lc_identification = "zh_cn ",
Lc_measurement = "zh_cn ",
Lc_time = "zh_cn ",
Lc_name = "zh_cn ",
Lang = "zh_CN.UTF-8"
Are supported and installed on your system.
Perl: Warning: falling back to the standard locale ("C ").
Adding User 'ploy '...
Adding new group 'ploy' (1002 )...
Adding new user 'ploy' (1002) with group 'ploy '...
Creating home directory '/home/deploy '...
Copying files from '/etc/skel '...
Enter new Unix Password:
Retype new Unix Password:
Passwd: Password updated successfully
Changing the user information for deploy
Enter the new value, or press enter for the default
Full name []:
Room number []:
Work phone []:
Home phone []:
Other []:
Is the information correct? [Y/n] y
[Email protected]: ~ $ Echo $ Lang
Zh_CN.UTF-8
Solve the problem above:
Export lang = en
Export signature AG
Export lc_all =
Echo $ Lang
[Email protected]: ~ $ Echo $ Lang
En_US.UTF-8
Grant deploy sudo group permissions to users
[Email protected]: ~ $ Sudo usermod-a-g sudo deploy
View deploy users
[Email protected]: ~ $ Id deploy
Uid = 1002 (deploy) gid = 1002 (deploy) groups = 1002 (deploy), 27 (SUDO)
Ii. Install rvm
Next, we will install rvm under user zlz. Popularize basic knowledge.
What is rvm?
Rvm is a command line tool that provides a convenient multi-version Ruby environment for management and switching.
Install rvm on the server with a common user, and then use rvm to install Ruby and gemset. Rvm is required, because it is impossible to deploy only one project on the server, and the versions used by the project are different.
Therefore, we install rvm under a common user, that is, install rvm under the user.
Switch to deploy.
[Email protected]: ~ $ Su-deploy
Password:
Install
[Email protected]: ~ $ \ Curl-SSL https://get.rvm.io | bash-s stable
Downloading https://github.com/wayneeseguin/rvm/archive/stable.tar.gz
Installing rvm to/home/deploy/. rvm/
Adding rvm path line to/home/deploy/. Profile/home/deploy/. bashrc/home/deploy/. zshrc.
Adding rvm Loading Line to/home/deploy/. bash_profile/home/deploy/. zlogin.
Installation of rvm in/home/deploy/. rvm/is almost complete:
* To start using rvm you need to run 'source/home/deploy/. rvm/scripts/rvm'
In all your open shell windows, in rare cases you need to reopen all shell windows.
# Deploy,
#
# Thank you for using rvm!
# We sincerely hope that rvm helps to make your life easier and more enjoyable !!!
#
#~ Wayne, Michal & team.
In case of problems: http://rvm.io/help and https://twitter.com/rvm_io
[Email protected]: ~ $ Source/home/deploy/. rvm/scripts/rvm
[Email protected]: ~ $ Rvm-V
Rvm 1.25.28 (stable) by Wayne E. Seguin <[email protected]>, Michal Papis <[email protected]> [https://rvm.io/]
View environment variables
[Email protected]: ~ $ Echo $ path
/Usr/local/bin:/usr/local/games:/usr/games:/home/deploy/. rvm/bin
Install a ruby version
[Email protected]: ~ $ Rvm install 1.9.3
Searching for Binary rubies, this might takes some time.
Found Remote File https://rvm.io/binaries/ubuntu/12.04/x86_64/ruby-1.9.3-p547.tar.bz2
Checking requirements for Ubuntu.
Installing requirements for Ubuntu.
Updating systemdeploy Password required for 'apt-Get -- quiet -- yes Update ':
Deploy Password required for 'apt-Get -- quiet -- yes Update ':
............
Installing required packages: gawk, libsqlite3-dev, sqlite3, libgdbm-Dev, PKG-config, libffi-dev ..........
Requirements installation successful.
Ruby-1.9.3-p547-# configure
Ruby-1.9.3-p547-# download
% Total % received % xferd average speed time Time Current
Dload upload total spent left speed
100 11.3 m 100 11.3 m 0 0 208 K 0 0:00:55 --: -- 159 K
Ruby-1.9.3-p547-# validate Archive
Ruby-1.9.3-p547-# Extract
Ruby-1.9.3-p547-# validate binary
Ruby-1.9.3-p547-# setup
Ruby-1.9.3-p547-# gemset created/home/deploy/. rvm/gems/[email protected]
Ruby-1.9.3-p547-# importing gemset/home/deploy /. rvm/gemsets/global. gems ....................................
Ruby-1.9.3-p547-# Generating global wrappers ........
Ruby-1.9.3-p547-# gemset created/home/deploy/. rvm/gems/ruby-1.9.3-p547
Ruby-1.9.3-p547-# importing gemsetfile/home/deploy/. rvm/gemsets/Default. Gems evaluated to empty gem list
Ruby-1.9.3-p547-# Generating default wrappers ........
View rvm version
[Email protected]: ~ $ Rvm-V
Rvm 1.25.28 (stable) by Wayne E. Seguin <[email protected]>, Michal Papis <[email protected]> [https://rvm.io/]
View environment variables
[Email protected]: ~ $ Echo $ path
/Home/deploy /. rvm/gems/ruby-1.9.3-p547/bin:/home/deploy /. rvm/gems/[email protected]/bin:/home/deploy /. rvm/Rubi/ruby-1.9.3-p547/bin:/home/deploy /. rvm/bin:/usr/local/games:/usr/games
Set the default Ruby version
[Email protected]: ~ $ Rvm 1.9.3 -- default
View Ruby version
[Email protected]: ~ $ Ruby-V
Ruby 1.9.3p547 (Revision 45962) [x86_64-linux]
Uservm list known
Command to list all known versions
[Email protected]: ~ $ Rvm List known
# MRI rubies
[Ruby-] 1.8.6 [-p420]
[Ruby-] 1.8.7 [-head] # Security released on head
[Ruby-] 1.9.1 [-p431]
[Ruby-] 1.9.2 [-head] # Security released on head
[Ruby-] 1.9.3 [-p547]
[Ruby-] 2.0.0-p451
[Ruby-] 2.0.0 [-p481]
[Ruby-] 2.1.1
[Ruby-] 2.1 [. 2]
[Ruby-] 2.1-head
Ruby-head
# Goruby
Goruby
# Topaz
Topaz
# Thecodeshop-MRI experimental patches
TCS
# Jamesgolick-all around gangster
Jamesgolick
# Minimalistic Ruby implementation-ISO 30170: 2012
Mruby [-head]
# Jruby
Jruby-1.6.8
Jruby [-1.7.13]
Jruby-head
# Rubinius
Rbx-1.3.3
Rbx-2.0.0
Rbx-2.1.1
RBx [-2.2.10]
RBx-head
# Ruby Enterprise Edition
Ree-1.8.6
REE [-1.8.7] [-2012.02]
# Kiji
Kiji
# Magev
Maglev[-head]
Maglev-1.0.0
# Mac OS X snow leopard or newer
Macruby-0.10
Macruby-0.11
Macruby [-0.12]
Macruby-nightly
Macruby-head
# Opal
Opal
# Ironruby
Ironruby [-1.1.3]
Ironruby-head
Because we need to go to the GIT server to pull the code, we need to generate a public key for the user deploy, and then put the public key on the GIT code server.
We can understand it as follows:
This process is like:
I bought a lock and a key, and then gave the lock to others. Then I took the key to open the lock for others.
Produce key pairs for deploy
[Email protected]: ~ $ Ssh-keygen-T DSA
Generating public/private DSA key pair.
Enter file in which to save the key (/home/deploy/. Ssh/id_dsa ):
Created directory '/home/deploy/. Ssh '.
Enter passphrase (empty for no passphrase ):
Enter same passphrase again:
Your identification has been saved in/home/deploy/. Ssh/id_dsa.
Your public key has been saved in/home/deploy/. Ssh/id_dsa.pub.
The key fingerprint is:
F4: 44: 37: 44: 6e: A8: 0a: 9d: F1: A3: AB: 69: 3B: 4f: 14: 21 [email protected]
The key's randomart image is:
+ -- [DSA 1024] ---- +
| E.. O = |
|... +. |
| O. o |
|. * +. |
|. + S. |
| O. |
| + |
| Oo. |
|. + = O |
+ ----------------- +
View the generated password pair:
[Email protected]: ~ $ Ll. Ssh/
Total 16
Drwx ------ 2 deploy 4096 Aug 14 16:33 ./
Drwxr-XR-x 4 deploy 4096 Aug 14 ../
-RW ------- 1 deploy 672 Aug 14 16:33 id_dsa -----> Private Key
-RW-r -- 1 deploy 601 Aug 14 16:33 id_dsa.pub -----> Public Key
Then upload the id_dsa.pub -----> Public Key to the server through git.
[Email protected]: ~ $ Cat. Ssh/id_dsa.pub
Ssh-DSS kernel + kernel/bqxe9x3/kernel/k1v/cojvpatknv/x3lrn4gurql/kiecicpxch/kernel + wlriuk/kernel + kernel/oaksofyfjb3/kernel + authorization + 0 dvyb + ozec7/zkmpbijy0ldeb/ag77g = [email protected]
Add deploy to gitolite. conf.
@ Rails_team = @ vincent_all zhanghuaxuan yangshukun zhanghuaxuanvm yangshukun2 wurain chenyuanheng yuanxiaofei xiaomacrm Jim newuser yangshukun3 apps deploy
Repo xmnewcrm
RW + = @ rails_team @ deploy
R = @ developer
In this way, you can pull the xmnewcrm code on the GIT server.
Deploy. Put pub in
650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M01/45/DE/wKioL1PsnNqyAn7pAAD7DKtN7T0712.jpg "Title =" qq201408095312.jpg "alt =" wkiol1psnnqyan7paad7dktn7t0712.jpg "/>
Locally, I am pushing the GIT configuration to the server.
This article is from the "8055082" blog and will not be reproduced!