Installation
Radiant is a Ruby on Rails application. It can be installed just like any other Rails application. However, in order to get the full benefits of Radiant as a content management framework its best to install it using the Ruby Gems packaging system. (See also AlternateInstallationMethods.)
To download and install the Radiant gem, execute the following from a command prompt:
$ gem install radiant Successfully installed radiant-0.6.1 Installing ri documentation for radiant-0.6.1... Installing RDoc documentation for radiant-0.6.1...
If you are asked to install any dependencies, press "y" for yes.
Note: Many Unix systems may require you to be root in order to install gems. An easy way to temporarily switch to root while executing a command is to prefix it with the sudo command. You could execute the command above with sudo like this:
$ sudo gem install radiant
And sudo would prompt you for your system password before executing the command as root. Not all Unix systems have sudo installed or configured for regular users. Talk to your system administrator if you have trouble installing the gem.
Create a New Project
The Radiant gem installs a new command to make it easy to get started with a Radiant project. The command is called radiant and is used like this:
$ radiant --database [database adapter] [path]
Where database adapter is the name of the name of the database driver that you are using ("mysql", "postgres", or "sqlite3") and path is the path to a directory where you would like to create your new project. If the directory doesn't exist, the radiant command will create it for you.
To use the radiant command to create a new SQLite 3 project you would execute:
$ radiant --database sqlite3 my_project create create CHANGELOG create CONTRIBUTORS create INSTALL create LICENSE create README create config create config/environments create config/environments/development.rb create config/environments/production.rb create config/environments/test.rb ...
This would create a new Radiant project in the my_project directory. If you take a look at the project directory you will see that it contains a number of new files and directories:
$ ls -l total 48 -rw-r--r-- 1 jlong jlong 1678 Mar 10 13:45 CHANGELOG -rw-r--r-- 1 jlong jlong 490 Mar 10 13:45 CONTRIBUTORS -rw-r--r-- 1 jlong jlong 1300 Mar 10 13:45 INSTALL -rw-r--r-- 1 jlong jlong 1078 Mar 10 13:45 LICENSE -rw-r--r-- 1 jlong jlong 1569 Mar 10 13:45 README -rw-r--r-- 1 jlong jlong 103 Mar 10 13:45 Rakefile drwxr-xr-x 7 jlong jlong 238 Mar 10 13:45 config drwxr-xr-x 2 jlong jlong 68 Mar 10 13:45 db drwxr-xr-x 2 jlong jlong 68 Mar 10 13:45 log drwxr-xr-x 13 jlong jlong 442 Mar 10 13:45 public drwxr-xr-x 11 jlong jlong 374 Mar 10 13:45 script drwxr-xr-x 4 jlong jlong 136 Mar 10 13:45 vendor
Note: If you are familiar with the typical Ruby on Rails project you will see a Radiant project has almost an identical directory structure. The key difference is that a Radiant project does not include an app directory. This is because the app directory contains most of the source code for a normal Rails application. In order to simplify the upgrade and install process all the Radiant source code is contained in the gem. A Radiant project is basically a striped back Rails project, with only the files necessary to configure and run the application.
Configure Radiant for Your Database
Once you've created a new project you will probably need to customize your database settings. The database configuration is stored in config/database.yml. If you ran the radiant command with the --database sqlite3 parameters your database configuration file will look something like this:
# SQLite version 3.x # gem install sqlite3-ruby development: adapter: sqlite3 database: db/development.sqlite3.db # Warning: The database defined as 'test' will be erased and # re-generated from your development database when you run 'rake'. # Do not set this db to the same as development or production. test: adapter: sqlite3 database: db/test.sqlite3.db production: adapter: sqlite3 database: db/production.sqlite3.db
Rails applications use a concept called "environments" to separate configuration for testing, development, and production. The "test" environment is used while running unit or functional tests. The "development" environment is used by Radiant developers. The "production" environment is optimized for running Radiant in normal circumstances.
As you can see in the file above, each environment has its own section for database settings.
If you are using MySQL or PostgreSQL you will need to create a database for each environment that you wish to run Radiant under. If you are using Sqlite the databases will be created for by Radiant when they are needed. For additional help configuring Radiant for your database see DatabaseConfiguration.
Bootstrap the Database
Radiant includes a special bootstrap rake task to make it easy to get started with a new Web site. The general format of the command is:
rake [environment] db:bootstrap
Where environment is either production or development depending on the database you are setting up. To set up the production database, run the command from the root of your project directory:
rake production db:bootstrap
There will be three prompts during the bootstrap process:
- Asking if it's OK wipe the production database clean
- Prompting you to create the admin user by asking for a name, username and password.
- Prompting you select a site template
Final Steps
If you are running Radiant on a hosting server you'll need to edit the config file of your webserver accordingly for your new install of Radiant. If this is your first time deploying a Rails application to a hosting server you may want to visit the Rails Wiki first to get started.
If you are going to just be running Radiant locally on your computer for now just run:
ruby script/server -e production
If you are using Lighttpd instead make sure you change this line in the config/lighttpd.conf file from:
"bin-environment" => ( "RAILS_ENV" => "development" )
to:
"bin-environment" => ( "RAILS_ENV" => "production" )
You should now be able to get to the default install of the Radiant CMS, congratulations! The default logon is "admin" and the default password is "radiant".
