• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

daisy_workflows/H22-May-2019-349283

packages/H22-May-2019-18,01512,954

.gitignoreH A D22-May-2019106 1513

.travis.ymlH A D22-May-2019763 3735

CONTRIB.mdH A D22-May-20193.1 KiB6352

LICENSEH A D22-May-201911.1 KiB202169

README.mdH A D22-May-20198.5 KiB205163

README.md

1## Linux Guest Environment for Google Compute Engine
2
3[![Build Status](https://travis-ci.org/GoogleCloudPlatform/compute-image-packages.svg?branch=master)](https://travis-ci.org/GoogleCloudPlatform/compute-image-packages) [![codecov](https://codecov.io/gh/GoogleCloudPlatform/compute-image-packages/branch/master/graph/badge.svg)](https://codecov.io/gh/GoogleCloudPlatform/compute-image-packages)
4
5This repository stores the collection of packages installed on Google supported
6Compute Engine [images](https://cloud.google.com/compute/docs/images).
7
8**Table of Contents**
9
10* [Background](#background)
11* [Packaging](#packaging)
12    * [Version Updates](#version-updates)
13    * [Package Distribution](#package-distribution)
14* [Troubleshooting](#troubleshooting)
15* [Contributing](#contributing)
16* [License](#license)
17
18## Background
19
20The Linux guest environment denotes the Google provided configuration and
21tooling inside of a [Google Compute Engine](https://cloud.google.com/compute/)
22(GCE) virtual machine. The
23[metadata server](https://cloud.google.com/compute/docs/metadata) is a
24communication channel for transferring information from a client into the guest.
25The Linux guest environment includes a set of scripts and daemons (long-running
26processes) that read the content of the metadata server to make a virtual
27machine run properly on our platform.
28
29## Packaging
30
31The guest Python code is packaged as a
32[compliant PyPI Python package](https://packaging.python.org/)
33that can be used as a library or run independently. In addition to the Python
34package, deb and rpm packages are created with appropriate init configuration
35for supported GCE distros. The packages are targeted towards distribution
36provided Python versions.
37
38Distro       | Package Type | Python Version | Init System
39------------ | ------------ | -------------- | -----------
40SLES 12      | rpm          | 2.7            | systemd
41SLES 15      | rpm          | 3.6            | systemd
42CentOS 6     | rpm          | 2.6            | upstart
43CentOS 7     | rpm          | 2.7            | systemd
44RHEL 6       | rpm          | 2.6            | upstart
45RHEL 7       | rpm          | 2.7            | systemd
46RHEL 8       | rpm          | 3.6            | systemd
47Ubuntu 14.04 | deb          | 2.7            | upstart
48Ubuntu 16.04 | deb          | 3.5 or 2.7     | systemd
49Ubuntu 18.04 | deb          | 3.6            | systemd
50Ubuntu 19.04 | deb          | 3.7            | systemd
51Debian 9     | deb          | 3.5 or 2.7     | systemd
52
53We build the following packages for the Linux guest environment.
54
55*   `google-compute-engine`
56    *  System init scripts (systemd, upstart, or sysvinit).
57    *  Includes udev rules, sysctl rules, rsyslog configs, dhcp configs for
58       hostname setting.
59    *  Entry point scripts created by the Python package located in `/usr/bin`.
60    *  Includes bash scripts used by `instance_setup`.
61*   `python-google-compute-engine`
62    *  The Python 2 package for Linux daemons and libraries.
63*   `python3-google-compute-engine`
64    *  The Python 3 package for Linux daemons and libraries.
65*   `google-compute-engine-oslogin`
66    *  The PAM and NSS modules for [OS Login](https://cloud.google.com/compute/docs/oslogin/)
67*   `gce-disk-expand`
68    *  The on-boot resize scripts for root partition.
69
70The package sources (RPM spec files and Debian packaging directories) are also
71included in this project. There are also [Daisy](https://github.com/GoogleCloudPlatform/compute-image-tools/tree/master/daisy)
72workflows for spinning up GCE VM's to automatically build the packages for
73Debian, Red Hat, and CentOS. See the [README](packaging/README.md) in the
74packaging directory for more details.
75
76#### Version Updates
77
78The method for making version updates differs by package.
79
80* All packages need the `VERSION` variable set in the `setup_{deb,rpm}.sh` build
81  scripts.
82* All packages need the `debian/changelog` file updated. Please use `dch(1)` to
83  update it.
84* `python-google-compute-engine` additionally needs the version specified in
85  `setup.py`. This is used for entry points through the Python egg and PyPI.
86* `google-compute-engine-oslogin` needs the version also updated in the
87  `Makefile`.
88
89#### Package Distribution
90
91The deb and rpm packages are published to Google Cloud repositories. Debian,
92CentOS, and RHEL use these repositories to install and update the
93`google-compute-engine`, `google-compute-engine-oslogin` and
94`python-google-compute-engine` (and `python3-google-compute-engine` for Python
953) packages. If you are creating a custom image, you can also use these
96repositories in your image.
97
98**For Debian, run the following commands as root:**
99
100Add the public repo key to your system:
101```
102curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
103```
104
105Add a source list file `/etc/apt/sources.list.d/google-cloud.list`:
106```
107sudo tee /etc/apt/sources.list.d/google-cloud.list << EOM
108deb http://packages.cloud.google.com/apt google-compute-engine-stretch-stable main
109deb http://packages.cloud.google.com/apt google-cloud-packages-archive-keyring-stretch main
110EOM
111```
112
113Install the packages to maintain the public key over time:
114```
115sudo apt update; sudo apt install -y google-cloud-packages-archive-keyring
116```
117
118You are then able to install any of the packages from this repo.
119
120**For RedHat based distributions, run the following commands as root:**
121
122Add the yum repo to a repo file `/etc/yum.repos.d/google-cloud.repo` for either
123EL6 or EL7. Change `DIST` to either 6 or 7 respectively:
124```
125DIST=7
126tee /etc/yum.repos.d/google-cloud.repo << EOM
127[google-compute-engine]
128name=Google Compute Engine
129baseurl=https://packages.cloud.google.com/yum/repos/google-compute-engine-el${DIST}-x86_64-stable
130enabled=1
131gpgcheck=1
132repo_gpgcheck=1
133gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg
134       https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
135EOM
136```
137
138You are then able to install any of the packages from this repo.
139
140## Troubleshooting
141
142**Deprecated Packages**
143
144Deprecated Package                   | Replacement
145------------------------------------ | ---------------------------------------------------------
146`google-compute-engine-jessie`       | `google-compute-engine` and `python-google-compute-engine`
147`google-compute-engine-stretch`      | `google-compute-engine` and `python-google-compute-engine`
148`google-compute-engine-init`         | `google-compute-engine`
149`google-compute-engine-init-jessie`  | `google-compute-engine`
150`google-compute-engine-init-stretch` | `google-compute-engine`
151`google-config`                      | `google-compute-engine`
152`google-config-jessie`               | `google-compute-engine`
153`google-config-stretch`              | `google-compute-engine`
154`google-compute-daemon`              | `python-google-compute-engine`
155`google-startup-scripts`             | `google-compute-engine`
156
157**An old CentOS 6 image fails to install the packages with an error on SCL**
158
159CentOS 6 images prior to `v20160526` may fail to install the package with
160the error:
161```
162http://mirror.centos.org/centos/6/SCL/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
163```
164
165Remove the stale repository file:
166`sudo rm -f /etc/yum.repos.d/CentOS-SCL.repo`
167
168**On some CentOS or RHEL 6 systems, extraneous python egg directories can cause
169the python daemons to fail.**
170
171In `/usr/lib/python2.6/site-packages` look for
172`google_compute_engine-2.4.1-py27.egg-info` directories and
173`google_compute_engine-2.5.2.egg-info` directories and delete them if you run
174into this problem.
175
176**Using boto with virtualenv**
177
178Specific to running `boto` inside of a Python
179[`virtualenv`](http://docs.python-guide.org/en/latest/dev/virtualenvs/),
180virtual environments are isolated from system site-packages. This includes the
181installed Linux guest environment libraries that are used to configure `boto`
182credentials. There are two recommended solutions:
183
184*   Create a virtual environment with `virtualenv venv --system-site-packages`.
185*   Install `boto` via the Linux guest environment PyPI package using
186    `pip install google-compute-engine`.
187
188## Contributing
189
190Have a patch that will benefit this project? Awesome! Follow these steps to have
191it accepted.
192
1931.  Please sign our [Contributor License Agreement](CONTRIB.md).
1941.  Fork this Git repository and make your changes.
1951.  Create a Pull Request against the
196    [development](https://github.com/GoogleCloudPlatform/compute-image-packages/tree/development)
197    branch.
1981.  Incorporate review feedback to your changes.
1991.  Accepted!
200
201## License
202
203All files in this repository are under the
204[Apache License, Version 2.0](LICENSE) unless noted otherwise.
205