-
Bash Scripts
Bash Scripts
debrpmdeb
curl -s https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash
#!/bin/bash unknown_os () { echo "Unfortunately, your operating system distribution and version are not supported by this script." echo echo "You can override the OS detection by setting os= and dist= prior to running this script." echo "You can find a list of supported OSes and distributions on our website: https://packages.gitlab.com/docs#os_distro_version" echo echo "For example, to force Ubuntu Trusty: os=ubuntu dist=trusty ./script.sh" echo echo "Please email [email protected] and let us know if you run into any issues." exit 1 } curl_check () { echo "Checking for curl..." if command -v curl > /dev/null; then echo "Detected curl..." else echo "Installing curl..." apt-get install -q -y curl fi } install_debian_keyring () { if [ "${os}" = "debian" ]; then echo "Installing debian-archive-keyring which is needed for installing " echo "apt-transport-https on many Debian systems." apt-get install -y debian-archive-keyring &> /dev/null fi } detect_os () { if [[ ( -z "${os}" ) && ( -z "${dist}" ) ]]; then # some systems dont have lsb-release yet have the lsb_release binary and # vice-versa if [ -e /etc/lsb-release ]; then . /etc/lsb-release if [ "${ID}" = "raspbian" ]; then os=${ID} dist=`cut --delimiter='.' -f1 /etc/debian_version` else os=${DISTRIB_ID} dist=${DISTRIB_CODENAME} if [ -z "$dist" ]; then dist=${DISTRIB_RELEASE} fi fi elif [ `which lsb_release 2>/dev/null` ]; then dist=`lsb_release -c | cut -f2` os=`lsb_release -i | cut -f2 | awk '{ print tolower($1) }'` elif [ -e /etc/debian_version ]; then # some Debians have jessie/sid in their /etc/debian_version # while others have '6.0.7' os=`cat /etc/issue | head -1 | awk '{ print tolower($1) }'` if grep -q '/' /etc/debian_version; then dist=`cut --delimiter='/' -f1 /etc/debian_version` else dist=`cut --delimiter='.' -f1 /etc/debian_version` fi else unknown_os fi fi if [ -z "$dist" ]; then unknown_os fi # remove whitespace from OS and dist name os="${os// /}" dist="${dist// /}" echo "Detected operating system as $os/$dist." } main () { detect_os curl_check # Need to first run apt-get update so that apt-transport-https can be # installed echo -n "Running apt-get update... " apt-get update &> /dev/null echo "done." # Install the debian-archive-keyring package on debian systems so that # apt-transport-https can be installed next install_debian_keyring echo -n "Installing apt-transport-https... " apt-get install -y apt-transport-https &> /dev/null echo "done." gpg_key_url="https://packages.gitlab.com/gitlab/gitlab-ce/gpgkey" apt_config_url="https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/config_file.list?os=${os}&dist=${dist}&source=script" apt_source_path="/etc/apt/sources.list.d/gitlab_gitlab-ce.list" echo -n "Installing $apt_source_path..." # create an apt config file for this repository curl -sSf "${apt_config_url}" > $apt_source_path curl_exit_code=$? if [ "$curl_exit_code" = "22" ]; then echo echo echo -n "Unable to download repo config from: " echo "${apt_config_url}" echo echo "This usually happens if your operating system is not supported by " echo "packagecloud.io, or this script's OS detection failed." echo echo "You can override the OS detection by setting os= and dist= prior to running this script." echo "You can find a list of supported OSes and distributions on our website: https://packages.gitlab.com/docs#os_distro_version" echo echo "For example, to force Ubuntu Trusty: os=ubuntu dist=trusty ./script.sh" echo echo "If you are running a supported OS, please email [email protected] and report this." [ -e $apt_source_path ] && rm $apt_source_path exit 1 elif [ "$curl_exit_code" = "35" ]; then echo "curl is unable to connect to packagecloud.io over TLS when running: " echo " curl ${apt_config_url}" echo "This is usually due to one of two things:" echo echo " 1.) Missing CA root certificates (make sure the ca-certificates package is installed)" echo " 2.) An old version of libssl. Try upgrading libssl on your system to a more recent version" echo echo "Contact [email protected] with information about your system for help." [ -e $apt_source_path ] && rm $apt_source_path exit 1 elif [ "$curl_exit_code" -gt "0" ]; then echo echo "Unable to run: " echo " curl ${apt_config_url}" echo echo "Double check your curl installation and try again." [ -e $apt_source_path ] && rm $apt_source_path exit 1 else echo "done." fi echo -n "Importing packagecloud gpg key... " # import the gpg key curl -L "${gpg_key_url}" 2> /dev/null | apt-key add - &>/dev/null echo "done." echo -n "Running apt-get update... " # update apt on this system apt-get update &> /dev/null echo "done." echo echo "The repository is setup! You can now install packages." } mainpiprpm
curl -s https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash
#!/bin/bash unknown_os () { echo "Unfortunately, your operating system distribution and version are not supported by this script." echo echo "You can override the OS detection by setting os= and dist= prior to running this script." echo "You can find a list of supported OSes and distributions on our website: https://packages.gitlab.com/docs#os_distro_version" echo echo "For example, to force CentOS 6: os=el dist=6 ./script.sh" echo echo "Please email [email protected] and let us know if you run into any issues." exit 1 } curl_check () { echo "Checking for curl..." if command -v curl > /dev/null; then echo "Detected curl..." else echo "Installing curl..." yum install -d0 -e0 -y curl fi } detect_os () { if [[ ( -z "${os}" ) && ( -z "${dist}" ) ]]; then if [ -e /etc/os-release ]; then . /etc/os-release os=${ID} if [ "${os}" = "poky" ]; then dist=`echo ${VERSION_ID}` elif [ "${os}" = "sles" ]; then dist=`echo ${VERSION_ID}` elif [ "${os}" = "opensuse" ]; then dist=`echo ${VERSION_ID}` else dist=`echo ${VERSION_ID} | awk -F '.' '{ print $1 }'` fi elif [ `which lsb_release 2>/dev/null` ]; then # get major version (e.g. '5' or '6') dist=`lsb_release -r | cut -f2 | awk -F '.' '{ print $1 }'` # get os (e.g. 'centos', 'redhatenterpriseserver', etc) os=`lsb_release -i | cut -f2 | awk '{ print tolower($1) }'` elif [ -e /etc/oracle-release ]; then dist=`cut -f5 --delimiter=' ' /etc/oracle-release | awk -F '.' '{ print $1 }'` os='ol' elif [ -e /etc/fedora-release ]; then dist=`cut -f3 --delimiter=' ' /etc/fedora-release` os='fedora' elif [ -e /etc/redhat-release ]; then os_hint=`cat /etc/redhat-release | awk '{ print tolower($1) }'` if [ "${os_hint}" = "centos" ]; then dist=`cat /etc/redhat-release | awk '{ print $3 }' | awk -F '.' '{ print $1 }'` os='centos' elif [ "${os_hint}" = "scientific" ]; then dist=`cat /etc/redhat-release | awk '{ print $4 }' | awk -F '.' '{ print $1 }'` os='scientific' else dist=`cat /etc/redhat-release | awk '{ print tolower($7) }' | cut -f1 --delimiter='.'` os='redhatenterpriseserver' fi else aws=`grep -q Amazon /etc/issue` if [ "$?" = "0" ]; then dist='6' os='aws' else unknown_os fi fi fi if [[ ( -z "${os}" ) || ( -z "${dist}" ) ]]; then unknown_os fi # remove whitespace from OS and dist name os="${os// /}" dist="${dist// /}" echo "Detected operating system as ${os}/${dist}." } finalize_yum_repo () { echo "Installing pygpgme to verify GPG signatures..." yum install -y pygpgme --disablerepo='gitlab_gitlab-ce' pypgpme_check=`rpm -qa | grep -qw pygpgme` if [ "$?" != "0" ]; then echo echo "WARNING: " echo "The pygpgme package could not be installed. This means GPG verification is not possible for any RPM installed on your system. " echo "To fix this, add a repository with pygpgme. Usualy, the EPEL repository for your system will have this. " echo "More information: https://fedoraproject.org/wiki/EPEL#How_can_I_use_these_extra_packages.3F" echo # set the repo_gpgcheck option to 0 sed -i'' 's/repo_gpgcheck=1/repo_gpgcheck=0/' /etc/yum.repos.d/gitlab_gitlab-ce.repo fi echo "Installing yum-utils..." yum install -y yum-utils --disablerepo='gitlab_gitlab-ce' yum_utils_check=`rpm -qa | grep -qw yum-utils` if [ "$?" != "0" ]; then echo echo "WARNING: " echo "The yum-utils package could not be installed. This means you may not be able to install source RPMs or use other yum features." echo fi echo "Generating yum cache for gitlab_gitlab-ce..." yum -q makecache -y --disablerepo='*' --enablerepo='gitlab_gitlab-ce' } finalize_zypper_repo () { zypper --gpg-auto-import-keys refresh gitlab_gitlab-ce } main () { detect_os curl_check yum_repo_config_url="https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/config_file.repo?os=${os}&dist=${dist}&source=script" if [ "${os}" = "sles" ] || [ "${os}" = "opensuse" ]; then yum_repo_path=/etc/zypp/repos.d/gitlab_gitlab-ce.repo else yum_repo_path=/etc/yum.repos.d/gitlab_gitlab-ce.repo fi echo "Downloading repository file: ${yum_repo_config_url}" curl -sSf "${yum_repo_config_url}" > $yum_repo_path curl_exit_code=$? if [ "$curl_exit_code" = "22" ]; then echo echo echo -n "Unable to download repo config from: " echo "${yum_repo_config_url}" echo echo "This usually happens if your operating system is not supported by " echo "packagecloud.io, or this script's OS detection failed." echo echo "You can override the OS detection by setting os= and dist= prior to running this script." echo "You can find a list of supported OSes and distributions on our website: https://packages.gitlab.com/docs#os_distro_version" echo echo "For example, to force CentOS 6: os=el dist=6 ./script.sh" echo echo "If you are running a supported OS, please email [email protected] and report this." [ -e $yum_repo_path ] && rm $yum_repo_path exit 1 elif [ "$curl_exit_code" = "35" ]; then echo echo "curl is unable to connect to packagecloud.io over TLS when running: " echo " curl ${yum_repo_config_url}" echo echo "This is usually due to one of two things:" echo echo " 1.) Missing CA root certificates (make sure the ca-certificates package is installed)" echo " 2.) An old version of libssl. Try upgrading libssl on your system to a more recent version" echo echo "Contact [email protected] with information about your system for help." [ -e $yum_repo_path ] && rm $yum_repo_path exit 1 elif [ "$curl_exit_code" -gt "0" ]; then echo echo "Unable to run: " echo " curl ${yum_repo_config_url}" echo echo "Double check your curl installation and try again." [ -e $yum_repo_path ] && rm $yum_repo_path exit 1 else echo "done." fi if [ "${os}" = "sles" ] || [ "${os}" = "opensuse" ]; then finalize_zypper_repo else finalize_yum_repo fi echo echo "The repository is setup! You can now install packages." } maingempython
curl -s https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.python.sh | bash
#!/bin/bash curl_check () { echo "Checking for curl..." if command -v curl > /dev/null; then echo "Detected curl..." else echo "curl could not be found, please install curl and try again" exit 1 fi } virtualenv_check () { if [ -z "$VIRTUAL_ENV" ]; then echo "Detected VirtualEnv: Please visit https://packages.gitlab.com/gitlab/gitlab-ce/install#virtualenv" fi } new_global_section () { echo "No pip.conf found, creating" mkdir -p "$HOME/.pip" pip_extra_url > $HOME/.pip/pip.conf } edit_global_section () { echo "pip.conf found, making a backup copy, and appending" cp $HOME/.pip/pip.conf $HOME/.pip/pip.conf.bak awk -v regex="$(escaped_pip_extra_url)" '{ gsub(/^\[global\]$/, regex); print }' $HOME/.pip/pip.conf.bak > $HOME/.pip/pip.conf echo "pip.conf appended, backup copy: $HOME/.pip/pip.conf.bak" } pip_check () { version=`pip --version` echo $version } abort_already_configured () { if [ -e "$HOME/.pip/pip.conf" ]; then if grep -q "gitlab/gitlab-ce" "$HOME/.pip/pip.conf"; then echo "Already configured pip for this repository, skipping" exit 0 fi fi } pip_extra_url () { printf "[global]\nextra-index-url=https://packages.gitlab.com/gitlab/gitlab-ce/pypi/simple\n" } escaped_pip_extra_url () { printf "[global]\\\nextra-index-url=https://packages.gitlab.com/gitlab/gitlab-ce/pypi/simple" } edit_pip_config () { if [ -e "$HOME/.pip/pip.conf" ]; then edit_global_section else new_global_section fi } main () { abort_already_configured curl_check virtualenv_check pip_check edit_pip_config echo "The repository is setup! You can now install packages." } main -
Manual
Manual Configuration
Jump to section:
If you'd prefer to install your repo on your system manually, follow the instructions below. If you feel something is missing or just want more info, don't hesitate to get in touch.
deb
-
In order to install a deb repo, first you need to install the GPG key that used to sign repository metadata. You do that using a utility called apt-key.
curl -L https://packages.gitlab.com/gitlab/gitlab-ce/gpgkey | sudo apt-key add -
- Refresh your package cache by running
sudo apt-get update
- If you are running Debian, install debian-archive-keyring so that official Debian repositories will be verified (Ubuntu users can skip this)
sudo apt-get install debian-archive-keyring
-
Install a package called apt-transport-https to make it possible for apt to fetch packages over https.
sudo apt-get install -y apt-transport-https
-
Create a file named
/etc/apt/sources.list.d/gitlab_gitlab-ce.listthat contains the repository configuration below.Make sure to replace ubuntu and trusty in the config below with your Linux distribution and version:
deb https://packages.gitlab.com/gitlab/gitlab-ce/ubuntu/ trusty main deb-src https://packages.gitlab.com/gitlab/gitlab-ce/ubuntu/ trusty main
- Run
sudo apt-get update
to update your local APT cache. - You can now install packages from your repository.
Valid options for os and dist parameters can be found in our support OS list in the docs.
rpm
-
Install pygpgme, a package which allows yum to handle gpg signatures, and a package called yum-utils which contains the tools you need for installing source RPMs.
sudo yum install pygpgme yum-utils
You may need to install the EPEL repository for your system to install these packages. If you do not install pygpgme, GPG verification will not work.
-
Create a file named
/etc/yum.repos.d/gitlab_gitlab-ce.repothat contains the repository configuration below.Make sure to replace el and 6 in the config below with your Linux distribution and version:
[gitlab_gitlab-ce] name=gitlab_gitlab-ce baseurl=https://packages.gitlab.com/gitlab/gitlab-ce/el/6/$basearch repo_gpgcheck=1 enabled=1 gpgkey=https://packages.gitlab.com/gitlab/gitlab-ce/gpgkey sslverify=1 sslcacert=/etc/pki/tls/certs/ca-bundle.crt metadata_expire=300 [gitlab_gitlab-ce-source] name=gitlab_gitlab-ce-source baseurl=https://packages.gitlab.com/gitlab/gitlab-ce/el/6/SRPMS repo_gpgcheck=1 enabled=1 gpgkey=https://packages.gitlab.com/gitlab/gitlab-ce/gpgkey sslverify=1 sslcacert=/etc/pki/tls/certs/ca-bundle.crt metadata_expire=300
- Update your local yum cache by running
yum -q makecache -y --disablerepo='*' --enablerepo='gitlab_gitlab-ce'
- You can now install packages from your repository.
Valid options for os and dist parameters can be found in our supported OS list in the docs.
zypper
-
Create a file named
/etc/zypp/repos.d/gitlab_gitlab-ce.repothat contains the repository configuration below.Make sure to replace el and 6 in the config below with your Linux distribution and version:
[gitlab_gitlab-ce] name=gitlab_gitlab-ce baseurl=https://packages.gitlab.com/gitlab/gitlab-ce/opensuse/13.2/$basearch enabled=1 repo_gpgcheck=1 pkg_gpgcheck=0 gpgkey=https://packages.gitlab.com/gitlab/gitlab-ce/gpgkey autorefresh=1 type=rpm-md [gitlab_gitlab-ce-source] name=gitlab_gitlab-ce-source baseurl=https://packages.gitlab.com/gitlab/gitlab-ce/el/6/SRPMS enabled=1 repo_gpgcheck=1 pkg_gpgcheck=0 gpgkey=https://packages.gitlab.com/gitlab/gitlab-ce/gpgkey autorefresh=1 type=rpm-md
- Update your local zypper cache by running
zypper --gpg-auto-import-keys refresh gitlab_gitlab-ce
- You can now install packages from your repository.
Valid options for os and dist parameters can be found in our supported OS list in the docs.
rubygems
Add the repository as a source
To install gems from this repository, you'll need to add the repository as a source.
gem source --add https://packages.gitlab.com/gitlab/gitlab-ce/
Using Bundler?
Add the repository to your Gemfile
To install gems from this repository, you'll need to add it as a source to your Gemfile.
Bundler 1.7.0 and above
In newer bundler versions, you can scope specific gems to a source, like so:
# Gemfile # Note: It's recommended you add the official https://rubygems.org source, unless your # packagecloud repository can meet all of the dependency requirements in the Gemfile. source "https://rubygems.org" source "https://packages.gitlab.com/gitlab/gitlab-ce" do gem "my-gem" gem "another-gem" end
Legacy versions of Bundler
Older versions of Bundler have several bugs around scoping gems to a single source using blocks, so you'll have to add the source globally at the top of the Gemfile.
# Gemfile source "https://rubygems.org" source "https://packages.gitlab.com/gitlab/gitlab-ce"
python
To install python packages from this repository, you'll need to add the repository as a source to pip.
Add the repository to pip
Add the repository to the
[global]section in your~/.pip/pip.conf[global] extra-index-url=https://packages.gitlab.com/gitlab/gitlab-ce/pypi/simple
Note: if you would like pip to use only this repository as a source, replace
extra-index-urlwithindex-url
VirtualEnv / requirements.txt
Add the repository to your VirtualEnv
Ensure you are running the latest version of pip inside your virtualenv:
my_virtualenv/bin/pip install --upgrade pip
Add this to the bottom of your
requirements.txt--extra-index-url=https://packages.gitlab.com/gitlab/gitlab-ce/pypi/simple
Note: if you would like pip to use only this repository as a source, replace
extra-index-urlwithindex-url
If you're looking for further clarification on anything, don't hesitate to get in touch!
-
-
Chef
Chef Cookbook
If you use chef to manage your infrastructure, you're in luck! We maintain a cookbook that makes it really easy to get up and running.
Using Berkshelf to manage your cookbooks? Depend on our cookbook like this:
cookbook "packagecloud"
If you're managing your cookbooks some other way, you can get our cookbook from supermarket.chef.io or github.
Once you have our cookbook installed, all you have to do to install this repo is add the following block to one of your recipes:
packagecloud_repo "gitlab/gitlab-ce" do type "deb" # or "rpm" or "gem" base_url "https://packages.gitlab.com/" end
The LWRP in our cookbook will determine what OS/Version you're on and setup the repository correctly for that particular node. It will also contact our installation API to issue a read token, and make sure our gpg key gets installed if necessary.
-
Puppet
Puppet Module
If you use puppet to manage your infrastructure, you're in luck! We maintain a module that makes it really easy to get up and running.
You can get our module on Puppet Forge or on GitHub.
To get this repo installed, you just need to add the following to one of your manifests:
include packagecloud packagecloud::repo { "gitlab/gitlab-ce": type => 'rpm', # or "deb" or "gem" server_address => 'https://packages.gitlab.com/', }The module will determine what OS/Version you're on and setup the repository correctly for that particular node. It will also contact our installation API to issue a read token, and make sure our gpg key gets installed if necessary.
-
Bundler
Using Bundler and packagecloud
Add the repository to your Gemfile
To install gems from this repository, you'll need to add it as a source to your Gemfile.
Bundler 1.7.0 and above
In newer bundler versions, you can scope specific gems to a source, like so:
# Gemfile # Note: It's recommended you add the official https://rubygems.org source, unless your # packagecloud repository can meet all of the dependency requirements in the Gemfile. source "https://rubygems.org" source "https://packages.gitlab.com/gitlab/gitlab-ce" do gem "my-gem" gem "another-gem" end
Legacy versions of Bundler
Older versions of Bundler have several bugs around scoping gems to a single source using blocks, so you'll have to add the source globally at the top of the Gemfile.
# Gemfile source "https://rubygems.org" source "https://packages.gitlab.com/gitlab/gitlab-ce"
-
Virtualenv
Using VirtualEnv and packagecloud
Add the repository to your VirtualEnv
Ensure you are running the latest version of pip inside your virtualenv:
my_virtualenv/bin/pip install --upgrade pip
Add this to the bottom of your
requirements.txt--extra-index-url=https://packages.gitlab.com/gitlab/gitlab-ce/pypi/simple
Note: if you would like pip to use only this repository as a source, replace
extra-index-urlwithindex-url -
Maven
Using Maven with Packagecloud
Add the repository to Maven
Add this to the
dependencyManagementsection of yourpom.xml<repositories> <repository> <id>gitlab-gitlab-ce</id> <url>https://packages.gitlab.com/gitlab/gitlab-ce/maven2</url> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>true</enabled> </snapshots> </repository> </repositories> -
Leiningen
Using Leiningen with Packagecloud
Add the repository to Leiningen
Add this entry to the top-level of your
project.cljfile:repositories [["snapshots" "https://packages.gitlab.com/gitlab/gitlab-ce/maven2"] ["releases" "https://packages.gitlab.com/gitlab/gitlab-ce/maven2"]] -
SBT
Using SBT with Packagecloud
Add the repository to SBT
For SNAPSHOT support (needs SBT 0.13.8 or above), create or append the following to a
project/maven.sbtfile in your project:addMavenResolverPlugin
Then, add this entry anywhere in your
build.sbtfile:resolvers += "gitlab-gitlab-ce" at "https://packages.gitlab.com/gitlab/gitlab-ce/maven2"
gitlab / gitlab-ce
APT/YUM repository for GitLab Community Edition packages