This assumes you have a working
webserver with PHP and MySQL or PgSQL
You will need PHP-Pear and following Pear Packages:
emerge PEAR-PEAR
emerge eix
pear install Pear
pear install Cache_Lite
pear install XML_Tree
pear install XML_RSS
pear install XML_Parser
pear install MDB2
pear install MDB2_Driver_mysql <OR> pear install MDB2_Driver_pgsql
Optional for the monitoring console:
emerge rrdtool
mkdir /path/to/gems/monitoring
chown webserver_user:webserver_group /path/to/gems/monitoring
chmod ug+wr /path/to/gems/monitoring
Edit your /etc/php/*/php.ini so allow_url_fopen = On
- Unpack the tar file to your desired web directory
- tar -C /path/to/webdir -xzvf gems_master-v1.x.tar.gz
- Edit the config.php file
- $log_path --> Where the GEMS application will write it's logs
- $log_file --> Logfile name
- $logging --> 1 turn on logging; 0 turn off logging
- $portage_dir --> Usually /usr/portage
- $cache_dir --> Where to write cache files, should be a temp
diretory
- $cache_life --> Seconds before expiring the cache
- $port --> The port number to use when connecting to
endpoints (endpoint config must match)
- $servername --> For the address the endpoints will report to, rather than use what PHP finds
- $db_type --> Now there is support for both mysql and pgsql
- $host --> For the database
- $dbuser and $dbpassword --> login info
for MySQL or PostGres
- $db --> The name of the database for GEMS (should be gems by default)
- Create the database
- MySQL
- Adding a database user to MySql:(optional if you have already setup users)
mysql -uroot -p
CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'newpassword';
grant select, insert,
update, delete, create, drop, file, index, alter, create temporary
tables, create view, show view on *.* to 'testuser'@'localhost' identified by 'newpassword';
- mysql -uroot -ppassword < gems.sql
- Postgres SQL
- If you need to create a database user(optional if you already setup users):
- From a regular shell
createuser -A -d -P -E -U postgres -W <user>
Enter password for new user:
Enter it again:
Password:
CREATE USER
This will create a user in postgres that cannot create databases or add db users
- Again from a regular shell
createdb -U <user> -W gems
This creates a database called gems, as user <user>
- Now enter the postgres shell
psql -U <user> -W gems
Password:
Welcome to psql 8.0.8, the PostgreSQL interactive terminal.
Type: \copyright for distribution terms
\h for help with SQL commands
\? for help with psql commands
\g or terminate with semicolon to execute query
\q to quit
gems=> \i gems.pgsql
gems=> \q
This starts a postgres shell in the gems database as user <user>
\i gems.pgsql loads the gems postgres DB schema
\q exits the postgres shell
- The user <user>, the password, and the database (gems in this case) are what you will use in gems master config.php file.
- This postgres info was taken from the Gentoo Postgres Guide. Check it out for further info.
- Setup the distfiles sym link (for the dist files mirror).
- cd /path/to/webdir/gems
- ln -s /usr/portage/distfiles distfiles
- This is the path for GENTOO_MIRRORS= in /etc/make.conf on the endpoints
- GENTOO_MIRRORS="http://example.com/gems/" (you don't need to add distfiles to the path, its assumed)
- Add these entries to your root crontab
- 30 3 * * * /usr/sbin/eix-sync
- 15 0 * * * cd /path/to/gems && /usr/bin/php /path/to/gems/glsa-update.php
- * * * * * cd /path/to/gems && /usr/bin/php /path/to/gems/wait_queue_watch.php 2>&1>/dev/null
- Setup your RSYNC mirror
- To make this server an rsync mirror as well, follow section 2 of this guide: http://www.gentoo.org/doc/en/rsync.xml
- The webserver must be added to the portage group (for fetching
distfiles)
- gpasswd -a <apache |
lighttpd> portage
- Login to GEMS http://gems.example.com/gems/
- Default login --> user: admin password:admin
- Users Menu --> Show users --> Edit admin --> Change
the default password
- Add a user
- You have to setup some endpoints before you can continue, so
you're done with the server for now.
GEMS Endpoint setup
This assumes PHP is installed with CURL
USE flags for PHP should be
posix, pnctl, cli, sockets, curl for gemsd to function
- Unpack the tar file to a temp directory
- tar -C /tmp -xzvf
gems_endpoint-v1.x.tar.gz
- Run inst_ep.sh
- ./ep_inst.sh or /bin/bash ep_inst.sh
- Edit /etc/make.conf and set GENTOO_MIRRORS="http://example.com/gems" whatever you decided on in step 4.3 above
- Go back to the GEMS web page and select Endpoint Utils >
Register/Unregister
- Enter the endpoint's IP address or DNS name (what you can ping it
by)
- Click Register
- The endpoint will now be registered to THIS GEMS server.
Other GEMS server will not be allowed to connect to it.
GEMS Master Server and Endpoint upgrade
Master Server
- Backup your exisit gems directory structure
- cp -a /path/to/gems /path/to/gems.bak
- Update the database schema for MySQL
- mysql -uroot -p gems <mysql_db_update.sql
- Configure config.php. Don't reuse the old one, new features have been added
- Add a new cron entry (does not have to run as root)
- * * * * * /usr/bin/php /path/to/gems/wait_queue_watch.php
Endpoint
- Run the ep_install.sh script
- You can opt not to copy the new config file in, your old one will work fine
GEMS Monitoring Agent Setup (optional)
- Unpack the tar file to a temp directory
- tar -C /tmp -xzvf gmond_agent-v1.x.tar.gz
- Run install.sh
- ./install.sh or /bin/bash install.sh
- The installer will add a user to your system called gmond, with
a uid 9803. You can change these if you want, the installer asks
you (you don't need to unless you have a good reason)
The user will belong to the users group, and will have a home dir of /dev/null, and login shell of /bin/false
- You will be asked for the url to your GEMs site. This is so the agent knows where to report in.
- If the url was correct, and the installer can verify it (using wget) it will continue
- The last step complies and installs WWW-Curl, the Perl Curl binding.
- You can now start the daemon, and add it to the startup
- /etc/init.d/gmond start
- rc-update add gmond default
- If
your GEMs monitoring site is setup correctly, you should see that the
agent reported in. It takes a few mintues to see data in the
graphs
- To view the console, login to your gems server, select the Alerts/Monitoring Menu, and click Monitoring Console.
GEMS Usage
Once you have your server setup, and your endpoints, you can start using gems. Here is an explanation of the pages.
- Portage Menu
- Search --> Searches Portage on this server
- Browse --> Browse Portage on this server
- Distfiles --> Shows all distfiles on this server
- Searches and browsing portage will give discriptions of the ebuild, along with some links:
- Browse Portage --> Brings you back to the main portage page
- Fetch... --> Brings you to a page that allows you to fetch the package to this server's mirror
- Deploy --> Brings you to the deploy page to install the package on endpoints
- Endpoint Utils Menu
- Register/Unregister --> For adding or removing endpoints from this GEMS server
- Run Command --> Run a command (as root) on an endpoint.
When the command is done, you'll see the return code, and the
last line of the command's output
- Send File --> Allows the Endpoint to pull files from a
repository on your GEMS server. This page also has a feature to
populate the repository through http upload
- Endpoint List --> Show all of the endpoints registered, and some information about them
- Inventory Collection --> Enter the names of endpoints to collect Portage software inventory
- Inventory Search --> Search by computer name or ebuild name
- Alerts/Monitoring Menu
- GEMS Alerts --> GEMS alerts, like install failures, inventory errors, and install success
- GLSA Alerts --> Shows the current GLSA notices from Gentoo.org
- Monitor Deployments --> Shows current GEMS processes, like installs and inventory collection
- Monitoring Console --> If you use the Monitoring Agent, you
can view system stats for your servers here. This feature is new,
and currently shows CPU use, System load, and Memory use
- View GEMS log --> Log of GEMS application activity
- Users
- Add users --> Add a user to the GEMS application
- Show users --> View and edit current GEMS users
How to Install software on an endpoint
This is a quick tutorial on how to get started with software installs to endpoints using bash as an example
- Login to GEMS and from the Portage menu, select Search (you can also use browse if you want)
- Search for bash
- Look for the bash shell (app-shells/bash) in the results
- Click Fetch Verbose This will fetch the package to this server, along with all dependencies
- When the fetch completes, click Deploy down at the bottom
- Enter your endpoint names in the targets box (Endpoints must be registered)
- (Optional) If you are installing a package that has a daemon you can use the next few boxes to add it to the run levels:
- Add daemon to init --> Yes or No, this is like doing rc-update add daemon default
- Run Level --> Default or Boot
- Daemon name --> The name of the daemon, like when using rc-update
- Click deploy package, you will see a connection to each endpoint.
- Go into Alerts/Monitoring and click on Monitor Deployments.
You will see the endpoints currently installing displayed in this
list. Refresh it frequently and you will see the list get shorter
as endpoints finish installing.
- Go into Alerts/Monitoring and click on GEMS Alerts. You will see the status of you deployments.