Gallery:Appliance - Gallery Codex
Personal tools

Gallery:Appliance

From Gallery Codex

The Gallery Appliance

Introduction

The Gallery VMware Appliance is a GNU/Linux distribution based on rPath Linux. Basically, it is a LAMP (Linux, Apache, MySQL, PHP) appliance with both Gallery 1 and Gallery 2 pre-installed and pre-configured, along with all of the required utilities and most of the optional ones. They are both also pre-loaded with some random pictures from various Gallery team members so that you can test things out without even having to find your own images.

A virtual appliance is the software and hardware of a real computer appliance, but hosted inside a virtualization layer. A virtual appliance contains the software needed to perform its task along with a description of the hardware resources it need, and runs separately from the host operating system. That way changes made inside the virtual appliance does not harm on reconfigure anything on the host operating system.

Wikipedia also has an article explaining virtual appliance basics

Support

A new forum has been created to deal with support for the Gallery Appliance. You can find there, called Gallery Appliance. Please direct all support requests there, Suggestions and Feedback are welcome as well and even have their own thread!

Installation

First, you will need to download and install the free VMware Player. You will also need to download the latest VMware Player Image for the Gallery Appliance. Once you have unzipped the Gallery Appliance, simply open it in VMware Player and start it up.

Once it is done booting, the screen should show you some simple instructions which will include the correct URL to visit. It will contain something like http://192.168.1.25/gallery/ and http://192.168.1.25/gallery2/, which you can simply load up in your local browser. Make a note of the URLs provided, and open that in your local browser. You will then be presented with either Gallery 1 or Gallery 2, depending on which URL you chose.

The Appliance doesn't come with it's own graphical user interface, so you can't browse the Gallery installs from within the appliance itself.

Both the system and mysql root password is BLANK, as in there is no password. Both Gallery's usernames are admin and the passwords are password.

At this point, you should consider this Gallery Appliance to be a DEMO because it is quite unsecure, and is not to be made publicly available before you follow the security recommendations mentioned below.

Development

This appliance could relatively easily be used for development if one needs a quick testing environment or would rather make changes in a safe environment. There are basically just three steps: 1) install subversion, 2) blow away current gallerys, 3) use svn to check out the "latest" of both.

Installing subversion

This is definitely the easiest step. Just use the built in package manager conary.

 # conary update --resolve subversion
 Including extra troves to resolve dependencies:
     neon:lib=0.24.7-5-0.1
 Applying update job 1 of 2:
     Install neon(:lib)=0.24.7-5-0.1
 Applying update job 2 of 2:
     Install subversion(:devel :devellib :doc :lib :locale :python :runtime)=1.2.3-8-0.2[~!builddocs]

Removing both current gallerys

We will use the built in init script gallery-appliance to do most of the work. We will also need to manually create a file so that the script doesn't try to re-setup gallery at the next boot. We will finish off by deleting the actual gallery and gallery2 directories. We could also remove the gallery, gallery2, g1conf and g2conf to make sure nothing bad happens in the future.

 # /etc/init.d/gallery-appliance clear
 Totally nuking gallerys...  Done!
 # touch /etc/gallery-pre-configured

Remove the gallery packages with conary, optionally you can backup the httpd config files that allow G1 and G2 to be installed in /srv/www/ instead of /srv/www/html...

 # cp /etc/httpd/conf.d/php_gallery.conf /etc/httpd/conf.d/php_gallery2.conf ~/
 # conary erase gallery g1conf g2conf
 Applying update job:
     Erase   g1conf(:runtime)=1.5.4_r1-2-1
     Erase   g2conf(:runtime)=2.1.2-1-1
     Erase   gallery(:lib :runtime)=/gallery.rpath.org@gallery:1/1.5.4-3-1
     Erase   gallery(:lib :runtime)=/gallery.rpath.org@gallery2:1/2.1.2-1-1
 # cp ~/php_gallery.conf ~/php_gallery2.conf /etc/httpd/conf.d/

Or just remove the directories...

 # rm -Rf /srv/www/gallery /srv/www/gallery2

Check out latest with SVN

There is no reason to re-create documentation that already exists. Please check out the SVN docs at http://codex.galleryproject.org/index.php/Gallery:Using_Subversion for information on checking out which ever Gallery version you want. Once you have done all this, you will need to setup G1 and G2 using the standard method. Visiting the ./gallery/ or ./gallery2/ directory in a web browser is enough.

Of note is the location where you will need to do the checkout. The document root for the server is /srv/www/html, even though if you were paying attention you found G1 and G2 in /srv/www/gallery and /srv/www/gallery2. The reason this worked is the conary gallery packages create a conf file for the apache web server to read. So you can either make a copy of the files or do your checkout in /srv/www/html

Security

As you read above, without a little bit of extra work you have to consider this as a DEMO appliance for Gallery 1 and 2. This appliance should not be made internet accessible and you should not store any important information on it. Fortunately, it is possible to secure it and I will outline the steps below.

Set a root system and mysql password

Simply run the following commands and we will change the system and mysql root passwords.

 % passwd root
 Changing password for user root.
 New UNIX password:
 Retype new UNIX password:
 passwd: all authentication tokens updated successfully.
 
 % mysqladmin -u root password 'new-password-here'

Clear the existing G1 and G2

The pre-configured G1 and G2 have their username and password published on the internet, so you will want to install G1 or G2 using your own choices. Also, you probably don't want our photos in your Gallery. The Gallery Appliance's special init script can take care of all this for you. The last command will prevent the appliance from trying to re-pre-configure itself.

 % /etc/init.d/gallery-appliance clear
 Totally nuking gallerys...  Done!
 % touch /etc/gallery-pre-configured

Create a new mysql user for Gallery 2

Of course, you need to change username and password to what you desire. The username gallery2 is perfectly reasonable. We may also need to re-create the gallery2 database, but if it fails with an already exists type message don't worry.

 % mysqladmin -uroot -p create gallery2
 Enter password:
 % mysql gallery2 -uroot -p -e"GRANT ALL ON gallery2.* TO username@localhost IDENTIFIED BY 'password'"
 Enter password:password

Update the init script with new mysql user/pass

This step is optional. After you change the mysql root password, the gallery-appliance init script will no longer work. This isn't that big a deal, so if you are happy with this then don't worry about it. It isn't a great idea to store passwords in plain text anyway. But if you would like to continue using the init script, it is easy to fix.

 % nano -w /etc/init.d/gallery-appliance

Now find the line that reads #MYUP="-u root -pPASSWORD" and fix it. You can simply put the mysql root password in place of PASSWORD or if you like, you can use the gallery2 user instead, changing root to gallery2 and putting the gallery2 password you set in PASSWORD.

Change this

 #MYUP="-u root -pPASSWORD"

To this

 MYUP="-u gallery2 -pmYnEWpasS"

Visit your G1 or G2 and configure

Once you have done all this, you will need to setup G1 and G2 using the standard method. Visiting the ./gallery/ or ./gallery2/ directory in a web browser is enough. The URLs are the ones displayed on the boot screen of the Gallery Appliance.

Init script features

The /etc/init.d/gallery-appliance init script has a few features you might find useful. At first startup, it pre-configures itself, using the file /etc/gallery-pre-configured to determine if it has been pre-configured. At shutdown, it will backup your G1 and G2 to /opt/g[1,2]backup. It also takes the parameters backup, restore, setup, clear, zip, bz2, secure and status.

backup

This option simply backs up the important G1 and G2 parts to the /opt/g1backup and /opt/g2backup directories. It can be used later to restore you settings, if desired.

 % /etc/init.d/gallery-appliance backup
 Backing up Gallery 1...  Done!
 Backing up Gallery 2...  Done!

restore

This option restores the G1 and G2 from the /opt/g1backup and /opt/g2backup directories if they exist. You can see below that it tries to create the gallery2 db, which may fail if it already exists.

 % /etc/init.d/gallery-appliance restore
 Restoring Gallery 1...  Done!
 Restoring Gallery 2...  Done!

setup

This is what is used to pre-configure G1 and G2. The start command does the same thing, both check for the presence of the file /etc/gallery-pre-configured and won't run if it exists.

 % /etc/init.d/gallery-appliance setup
 Pre-configuring gallery...  Done!

clear

This is used to nuke the G1 and G2 so you can start over if you wish. Be careful, it removes the /etc/gallery-pre-configured file so that you can run the start or setup command. This means that if you reboot, you're gallery *will* be pre-configured again.

 % /etc/init.d/gallery-appliance clear
 Totally nuking gallerys...  Done!

zip / bz2

This command creates a .zip or .tar.bz2 of your current G1 and G2, so that you can do with it what you like. You could keep an off-system backup, use it to transfer your gallery to another server or even decorate your cubicle.

 % /etc/init.d/gallery-appliance zip
 Backing up Gallery 1...  Done!
 Backing up Gallery 2...  Done!
 Your G1 data has been zip'd to /opt/gallery1-contents.zip
 Your G2 data has been zip'd to /opt/gallery2-contents.zip
 % /etc/init.d/gallery-appliance bz2
 Backing up Gallery 1...  Done!
 Backing up Gallery 2...  Done!
 Your G1 data has been bzip2'd to /opt/gallery1-contents.tar.bz2
 Your G2 data has been bzip2'd to /opt/gallery2-contents.tar.bz2

secure

This command simply points you to this wiki page.

 % /etc/init.d/gallery-appliance secure
 Please visit http://codex.galleryproject.org/index.php/Gallery:Appliance
 for information on securing this appliance.

status

This command will tell you if G1 and G2 appear to be pre-configured.

 % /etc/init.d/gallery-appliance status
 Gallery appears to be pre-configured, use the 'clear' option to undo this
advertisements