https://wiki.archlinux.org/api.php?action=feedcontributions&user=Intrixius&feedformat=atomArchWiki - User contributions [en]2024-03-28T09:29:15ZUser contributionsMediaWiki 1.41.0https://wiki.archlinux.org/index.php?title=Redmine&diff=376684Redmine2015-06-01T09:42:28Z<p>Intrixius: changed test script because "script/rails no longer exists"</p>
<hr />
<div>[[Category:Version Control System]]<br />
{{Related articles start}}<br />
{{Related|Ruby on Rails}}<br />
{{Related|RVM}}<br />
{{Related|MariaDB}}<br />
{{Related|Apache}}<br />
{{Related|Nginx}}<br />
{{Related articles end}}<br />
'''Redmine''' is a [[Wikipedia:free and open source software|free and open source]], web-based [[Wikipedia:project management|project management]] and [[Wikipedia:Issue tracking system|issue tracking]] tool. It handles multiple projects and subprojects. It [http://www.redmine.org/projects/redmine/wiki/Features features] per project wikis and forums, time tracking, and flexible role based access control. It includes a [[Wikipedia:calendar|calendar]] and [[Wikipedia:Gantt chart|Gantt chart]]s to aid visual representation of projects and their [[Wikipedia:time limit|deadlines]]. Redmine integrates with various [[Wikipedia:version control|version control]] systems and includes a repository browser and diff viewer.<br />
<br />
Redmine is written using the [[Ruby on Rails]] framework. It is cross-platform and cross-[[Wikipedia:database|database]] and supports 34 languages.<br />
<br />
==Prerequisites==<br />
<br />
This document will guide you through the installation process of Redmine and all of its prerequisites, including the optional ones. If desired, however, you may install Redmine and its prerequisites separately, simply referring to the relevant sections below.<br />
<br />
Although this guide will go through the entire installation process, this is not a one way path. Redmine can use different versions of the requisite software. For example the database requirement can be provided by mariaDB, mySQL, postgreSQL, etc.<br />
<br />
{{Note|This guide is a default suggestion, feel free to substitute any of the prerequisites mentioned on this page.}}<br />
<br />
===Ruby===<br />
<br />
{| border="1" class="wikitable" style="text-align:center;"<br />
! Redmine version<br />
! Supported Ruby Versions<br />
! Rails version used<br />
|-<br />
! 3.0.2<br />
| style="text-align:left;" | '''ruby''' 1.9.3<sup>3</sup>, 2.0.0<sup>2</sup>, 2.1, 2.2<sup>1</sup><br />
| '''Rails''' 4.2<sup>0</sup><br />
|}<br />
<br />
There are two simple ways to install Ruby: installing the {{Pkg|ruby}} package as described in [[ruby]] or installing RVM as described in [[RVM]] '''(recommended)'''.<br />
<br />
<br />
{{Note | <sup>0</sup> Rails 4.2.1 has non ASCII URL issue on MinGW Ruby ([http://rubyinstaller.org/ Windows-based installer]) thin and puma ([http://www.redmine.org/issues/19321 #19321], [http://www.redmine.org/issues/19374 #19374]) }}<br />
{{Note | <sup>1</sup> MinGW Ruby 2.2 has nokogiri issue ([http://www.redmine.org/issues/19419 #19419]).}}<br />
{{Note | <sup>2</sup> As of 2013-03-19, SQL Server support is reported broken with '''ruby 2.0.0 under Windows''' because of a [https://github.com/rails-sqlserver/tiny_tds/issues/110 database adapter gem incompatibility]}}<br />
{{Note | <sup>3</sup> MRI 1.9.3p327 contains a [http://bugs.ruby-lang.org/issues/7374 bug] breaking plugin loading under Windows which 1.9.3p194 or 1.9.3p392 haven't.}}<br />
{{Warning|If you use RVM, pay attention to the single and multiple user differences! If you are not creating a hosting service, the multiple user (available for all users on the machine) should be the choice for simpler debuging.}}<br />
<br />
===Database===<br />
<br />
Redmine [http://www.redmine.org/projects/redmine/wiki/RedmineInstall#Database supports many different databases].<br />
<br />
====MariaDB 5.0 or higher (recommended)====<br />
MariaDB is a drop-in replacement for MySQL, in fact it was a fork of it and maintain binary compatibility. It is also [https://www.archlinux.org/news/mariadb-replaces-mysql-in-repositories/ Arch Linux's default implementation of MySQL].<br />
<br />
To install {{Pkg|mariadb}} simply refer to [[MySQL]].<br />
<br />
====MySQL 5.0 or higher====<br />
[https://www.archlinux.org/news/mariadb-replaces-mysql-in-repositories/ Oracle MySQL was dropped] to the [[AUR]].<br />
<br />
{{AUR|mysql}} in the [[AUR]].<br />
<br />
====PostgreSQL 8.2 or higher====<br />
To install {{Pkg|postgresql}} simply refer to [[Postgresql]].<br />
<br />
Make sure your database datestyle is set to ISO (Postgresql default setting). You can set it using:<br />
<br />
{{bc|1=ALTER DATABASE "redmine_db" SET datestyle="ISO,MDY";}}<br />
<br />
{{Note|Some bugs in PostgreSQL 8.4.0 and 8.4.1 affect Redmine behavior ([[http://www.redmine.org/issues/4259 #4259]], [[http://www.redmine.org/issues/4314 #4314]]), they are fixed in PostgreSQL 8.4.2}}<br />
<br />
====Microsoft SQL Server====<br />
{{Warning|Support is temporarily broken (with ruby 2.0.0 under Windows because of [https://github.com/rails-sqlserver/tiny_tds/issues/110 database adapter gem incompatibility]).}}<br />
<br />
====SQLite 3====<br />
Not supported for multi-user production use. So, it will not be detailed how to install and configure it for use with Redmine. See [http://www.redmine.org/projects/redmine/wiki/RedmineInstall#Supported-database-back-ends upstream document] for more info.<br />
<br />
===Web Server===<br />
<br />
====Apache====<br />
To install {{Pkg|apache}} simply refer to [[Apache]].<br />
<br />
====Mongrel====<br />
To install Mongrel server (ruby gem) simply refer to [[Ruby_on_Rails#Mongrel]]{{Dead link|2015|02|05}}.<br />
<br />
==== Unicorn ====<br />
To install Unicorn server (ruby gem) simply refer to [[Ruby_on_Rails#Unicorn]].<br />
<br />
====Nginx====<br />
To install {{Pkg|nginx}} simply refer to [[Nginx]].<br />
<br />
====Apache Tomcat====<br />
To install {{Pkg|tomcat6}} or {{Pkg|tomcat7}} simply refer to [[Tomcat]].<br />
<br />
==Optional Prerequisites==<br />
<br />
===SCM (Source Code Management)===<br />
<br />
<table border="1"><br />
<tr><br />
<th>SCM</th><br />
<th>Supported versions</th><br />
<th>Comments</th><br />
</tr><br />
<tr><br />
<td>[http://git-scm.com Git]</td><br />
<td>>=1.5.4.2</td><br />
<td></td><br />
</tr><br />
<tr><br />
<td>[http://subversion.apache.org Subversion]</td><br />
<td>1.3, 1.4, 1.5, 1.6 & 1.7</td><br />
<td>1.3 or higher required.<br/><br />
Does not support Ruby Bindings for Subversion.<br/><br />
Subversion 1.7.0 and 1.7.1 contains bugs [http://www.redmine.org/issues/9541 #9541]</td><br />
</tr><br />
<tr><br />
<td>[http://www.selenic.com/mercurial Mercurial]</td><br />
<td>>=1.6</td><br />
<td>Support bellow version 1.6 is droped as seen in [http://www.redmine.org/issues/9465 #9465].</td><br />
</tr><br />
<tr><br />
<td>[http://bazaar-vcs.org Bazaar]</td><br />
<td>>= 2.0.4</td><br />
<td></td><br />
</tr><br />
<tr><br />
<td>[http://darcs.net Darcs]</td><br />
<td>>=1.0.7</td><br />
<td></td><br />
</tr><br />
<tr><br />
<td>[http://www.nongnu.org/cvs CVS]</td><br />
<td>1.12.12</td><br />
<td>1.12 required.<br/><br />
Will not work with CVSNT.</td><br />
</tr><br />
</table><br />
<br />
More information can be read at [http://www.redmine.org/projects/redmine/wiki/RedmineRepositories Redmine Repositories Wiki].<br />
<br />
===ImageMagick (recommended)===<br />
[http://www.imagemagick.org ImageMagick] is necessary to enable Gantt export to a [[wikipedia:Portable_Network_Graphics|PNG]] file.<br />
<br />
To install {{pkg|imagemagick}} simply:<br />
# pacman -S imagemagick<br />
<br />
===Ruby OpenID Library===<br />
To enable [http://janrain.com/openid-enabled OpenID] support, is required a version >= 2 of the library.<br />
<br />
==Installation==<br />
<br />
===Build and Installation===<br />
Download, build and install the {{AUR|redmine}} package from the [[AUR]].<br />
<br />
{{Note|Detailed build instructions are in [[Arch User Repository#Build the package|Build the package]]. It is '''HIGHLY''' recommended to read the [[AUR]] page to understand what are you doing. }}<br />
<br />
===Database Configuration===<br />
<br />
Now, we will need to create the database that the Redmine will use to store your data. For now on, the database and its user will be named {{ic|redmine}}. But this names can be changed to anything else.<br />
<br />
{{Note|The configuration for [[MariaDB]] and [[MySQL]] will be the same since both are binary compatible.}}<br />
<br />
====Database Creation====<br />
<br />
To create the database, the user and set privileges (MariaDB and MySQL >= 5.0.2):<br />
{{hc|# mysql -u root -p|<br />
CREATE DATABASE redmine CHARACTER SET UTF8;<br />
CREATE USER 'redmine'@'localhost' IDENTIFIED BY 'my_password';<br />
GRANT ALL PRIVILEGES ON redmine.* TO 'redmine'@'localhost';}}<br />
<br />
For versions of MariaDB and MySQL prior to 5.0.2:<br />
{{hc|# mysql -u root -p|<br />
CREATE DATABASE redmine CHARACTER SET UTF8;<br />
GRANT ALL PRIVILEGES ON redmine.* TO'redmine'@'localhost' IDENTIFIED BY 'my_password';}}<br />
<br />
For PostgreSQL:<br />
{{bc|1=CREATE ROLE redmine LOGIN ENCRYPTED PASSWORD 'my_password' NOINHERIT VALID UNTIL 'infinity';<br />
CREATE DATABASE redmine WITH ENCODING='UTF8' OWNER=redmine;}}<br />
<br />
For SQLServer:<br />
<br />
Although the database, login and user can be created within SQL Server Management Studio with a few clicks, you can always use the command line with {{ic|SQLCMD}}:<br />
{{bc|1=USE [master]<br />
GO<br />
-- Very basic DB creation<br />
CREATE DATABASE [REDMINE]<br />
GO<br />
-- Creation of a login with SQL Server login/password authentication and no password expiration policy<br />
CREATE LOGIN [REDMINE] WITH PASSWORD=N'redminepassword', DEFAULT_DATABASE=[REDMINE], CHECK_EXPIRATION=OFF, CHECK_POLICY=OFF<br />
GO<br />
-- User creation using previously created login authentication<br />
USE [REDMINE]<br />
GO<br />
CREATE USER [REDMINE] FOR LOGIN [REDMINE]<br />
GO<br />
-- User permissions set via roles<br />
EXEC sp_addrolemember N'db_datareader', N'REDMINE'<br />
GO<br />
EXEC sp_addrolemember N'db_datawriter', N'REDMINE'<br />
GO}}<br />
<br />
{{Note|If you want to use additional environments, you must create separate databases for each one (for example: ''development'' and ''test'').}}<br />
<br />
====Database Access Configuration====<br />
<br />
Now you need to configure Redmine to access the database we just created. To do that you have to copy {{ic|/usr/share/webapps/redmine/config/database.yml.example}} to {{ic|database.yml}}:<br />
<br />
# cd /usr/share/webapps/redmine/config<br />
# cp database.yml.example database.yml<br />
<br />
And then edit this file in order to configure your database settings for "production" environment (you can configure for the "development" and "test" environments too, just change the appropriate sections).<br />
<br />
Example for MariaDB and MySQL database:<br />
{{hc|nano database.yml|<br />
production:<br />
adapter: mysql2<br />
database: redmine<br />
host: localhost<br />
port: 3307 '''#If your server is not running on the standard port (3306), set it here, otherwise this line is unnecessary.'''<br />
username: redmine<br />
password: my_password}}<br />
<br />
{{Note|For ruby1.9 the "adapter" value must be set to {{ic|mysql2}}, and for ruby1.8 or jruby, it must be set to {{ic|mysql}}.}}<br />
<br />
Example for PostgreSQL database:<br />
{{hc|nano database.yml|<br />
production:<br />
adapter: postgresql<br />
database: redmine<br />
host: localhost<br />
username: redmine<br />
password: my_password<br />
encoding: utf8<br />
schema_search_path: <database_schema> (default - public)}}<br />
<br />
Example for a SQL Server database:<br />
{{hc|nano database.yml|<br />
production:<br />
adapter: sqlserver<br />
database: redmine<br />
host: localhost '''#Set not default host (localhost) here, otherwise this line is unnecessary.'''<br />
port: 1433 '''#Set not standard port (1433) here, otherwise this line is unnecessary.'''<br />
username: redmine<br />
password: my_password<br />
}}<br />
<br />
=== Ruby gems ===<br />
Redmine requires some [[Ruby#RubyGems|RubyGems]] to be installed and there are multiple ways of installing them (as listed on the referenced page).<br />
* prototype-rails<br />
* unicorn (an application-server)<br />
* mysql2 (high-performance Ruby bindings for MySQL)<br />
* coderay<br />
* erubis<br />
* fastercsv<br />
* rdoc<br />
* net-ldap<br />
* rack-openid<br />
<br />
Obviously, if you choose a different database-server, or want to use a different application-server you should replace ''mysql2'' and ''unicorn'' to your liking.<br />
<br />
====Adding Additional Gems (Optional)====<br />
If you need to load gems that are not required by Redmine core (eg. Puma, fcgi), create a file named {{ic|Gemfile.local}} at the root of your redmine directory. It will be loaded automatically when running {{ic|bundle install}}:<br />
<br />
{{hc|# nano Gemfile.local|<br />
gem 'puma'}}<br />
<br />
==== Check previously installed gems ====<br />
The Redmine devs included Bundler in Redmine, which can manage Gems just like pacman manages packages. Run the following command to assure that all Redmine dependencies are met:<br />
# bundle install --without development test<br />
This should output a list of gems Redmine needs.<br />
<br />
====Gems Installation====<br />
<br />
{{Note|If you prefer, you can install all the gems as pacman packages. You have only to search for the gem package and install them as usual. As of using Ruby gem is much simpler to manage and maintain up to date gems, this will be preferable and used as default bellow.}}<br />
<br />
Redmine uses Bundler to manage gems dependencies. So, you need to install Bundler first:<br />
# gem install bundler<br />
<br />
Then you can install all the gems required by Redmine using the following command:<br />
# cd /usr/share/webapps/redmine<br />
# bundle install<br />
<br />
To install without the ruby ''development'' and ''test'' environments use this instead of the last command:<br />
# bundle install --without development test<br />
<br />
{{Note|You can include/exclude environments using the above syntax.}}<br />
<br />
Although {{Pkg|imagemagick}} is highly [[#ImageMagick_.28recommended.29|recommended]], if you do not use it, you should skip the installation of the {{ic|rmagick}} gem using:<br />
<br />
# bundle install --without rmagick<br />
<br />
{{Note|Only the gems that are needed by the adapters you have specified in your database configuration file are actually installed (eg. if your {{ic|config/database.yml}} uses the ''mysql2'' adapter, then only the mysql2 gem will be installed). Do not forget to re-run {{ic|bundle install}} when you change or add adapters in this file.}}<br />
<br />
===Session Store Secret Generation===<br />
Now you must generate a random key that will be used by Rails to encode cookies that stores session data thus preventing their tampering:<br />
<br />
# rake generate_secret_token<br />
<br />
{{Note|For Redmine prior to 2.x this step is done by executing {{ic|# rake generate_session_store}}.}}<br />
<br />
{{Warning|Generating a new secret token invalidates all existing sessions after restart.}}<br />
<br />
===Database Structure Creation===<br />
With the database created and the access configured for Redmine, now it is time to create the database structure. This is done by running the following command under the application root directory:<br />
<br />
# cd /usr/share/webapps/redmine<br />
# RAILS_ENV=production rake db:migrate<br />
<br />
These command will create tables by running all migrations one by one then create the set of the permissions and the application administrator account, named admin.<br />
<br />
===Database Population with Default Data===<br />
Now you may want to insert the default configuration data in database, like basic types of task, task states, groups, etc. To do so execute the following:<br />
<br />
# RAILS_ENV=production rake redmine:load_default_data<br />
<br />
Redmine will prompt for the data set language that should be loaded; you can also define the REDMINE_LANG environment variable before running the command to a value which will be automatically and silently picked up by the task:<br />
<br />
# RAILS_ENV=production REDMINE_LANG=pt-BR rake redmine:load_default_data<br />
<br />
{{Note|This step is not mandatory, but it certainly will save you a lot of work to start using Redmine. And for a first time it can be very instructive.}}<br />
<br />
===File System Permissions===<br />
The user account running the application '''must''' have write permission on the following subdirectories:<br />
<br />
'''files''': storage of attachments.<br />
'''log''': application log file production.log.<br />
'''tmp''' and '''tmp/pdf''': used to generate PDF documents among other things (create these ones if not present).<br />
<br />
Assuming you run the application with a the default Apache user {{ic|http}} account:<br />
<br />
# mkdir tmp tmp/pdf public/plugin_assets<br />
# chown -R http:http files log tmp public/plugin_assets<br />
# chmod -R 755 files log tmp tmp/pdf public/plugin_assets<br />
<br />
===Test the installation===<br />
To test your new installation using WEBrick web server run the following in the Redmine folder:<br />
<br />
# ruby bin/rails server webrick -e production<br />
<br />
Once WEBrick has started, point your browser to '''http://localhost:3000/'''. You should now see the application welcome page. Use default administrator account to log in: '''''admin'''''/'''''admin'''''. You can go to Administration menu and choose Settings to modify most of the application settings.<br />
<br />
{{Warning|Webrick is not suitable for production use, please only use webrick for testing that the installation up to this point is functional. Use one of the many other guides in this wiki to setup redmine to use either Passenger (aka mod_rails), FCGI or a Rack server (Unicorn, Thin, Puma or hellip) to serve up your redmine.}}<br />
<br />
===Configure the production server===<br />
For Apache and Nginx, it is recommended to use Phusion Passenger. [http://www.modrails.com/ Passenger], also known as {{ic|mod_rails}}, is a module available for [[Nginx]] and [[Apache]].<br />
<br />
Start by installing the 'passenger' gem:<br />
# gem install passenger<br />
<br />
Now you have to look at your passenger gem installation directory to continue. If you do not known where it is, type:<br />
# gem env<br />
<br />
And look at the {{ic|GEM PATHS}} to find where the gems are installed. If you followed this guide and installed [[RVM]], you can have more than one path, look at the one you are using.<br />
<br />
For this guide so far, the gem path is {{ic|/usr/local/rvm/gems/ruby-2.0.0-p247@global}}.<br />
# cd /usr/local/rvm/gems/ruby-2.0.0-p247@global/gems/passenger-4.0.23<br />
<br />
If you are aiming to use [[Apache]], run:<br />
# passenger-install-apache2-module<br />
<br />
In case a rails application is deployed with a sub-URI, like http://example.com/yourapplication, some additional configuration is required, see [http://www.modrails.com/documentation/Users%20guide%20Apache.html#deploying_rails_to_sub_uri the modrails documentation]<br />
<br />
For [[Nginx]]:<br />
# passenger-install-nginx-module<br />
<br />
And finally, the installer will provide you with further information regarding the installation (such as installing additional libraries). So, to setup your server, simply follow the output from the passenger installer.<br />
<br />
==Updating==<br />
<br />
Backup the files used in Redmine:<br />
# tar czvf ~/redmine_files.tar.gz -C /usr/share/webapps/redmine/ files<br />
<br />
Backup the plugins installed in Redmine:<br />
# tar czvf ~/redmine_plugins.tar.gz -C /usr/share/webapps/redmine/ plugins<br />
<br />
Backup the database:<br />
# mysqldump -u root -p <redmine_database> | gzip > ~/redmine_db.sql.gz<br />
<br />
Update the package as normal (through [[AUR]]):<br />
# wget https://aur.archlinux.org/packages/re/redmine/redmine.tar.gz<br />
# tar -zxpvf redmine.tar.gz<br />
# cd redmine<br />
<br />
Inspect the downloaded files, mainly the [[PKGBUILD]], and then build:<br />
# makepkg -s<br />
# pacman -U redmine-2.3.0-2-any.pkg.tar.gz<br />
<br />
{{Note|To simplify all this [[AUR]] install and update process, you can always use the [[AUR helpers]], although this is not a supported way.}}<br />
<br />
Update the gems requirements:<br />
# bundle update<br />
<br />
For a clean gems environment, you may want to remove all the gems and reinstall them. To go through this, do:<br />
# for x in `gem list --no-versions`; do gem uninstall $x -a -x -I; done<br />
<br />
{{Warning|The command above will delete ALL the gems in your system or user, depending of what type of Ruby installation you did in the prerequisites step. You must take care or you can stop working another applications that rely on Ruby gems.}}<br />
<br />
If you did the last step and removed all the gems, now you will need to reinstall them all:<br />
# gem install bundler<br />
# bundle install --without development test<br />
<br />
{{Note|If you removed ALL the gems as above, and used a server that uses a gem, remember to reinstall the server gem: passenger (for Apache and Nginx), Mongrel or Unicorn. To do this, just follow the steps in the installation tutorial above.}}<br />
<br />
Copy the saved files:<br />
# tar xzvf ~/redmine_files.tar.gz -C /usr/share/webapps/redmine/<br />
<br />
Copy the installed plugins<br />
# tar xzvf ~/redmine_plugins.tar.gz -C /usr/share/webapps/redmine/<br />
<br />
Regenerate the secret token:<br />
# cd /usr/share/webapps/redmine<br />
# rake generate_secret_token<br />
<br />
Check for any themes that you may have installed in the {{ic|public/themes}} directory. You can copy them over but checking for updated version is ideal.<br />
<br />
{{Warning|Do NOT overwrite config/settings.yml with the old one.}}<br />
<br />
Update the database. This step is the one that could change the contents of your database. Go to your new redmine directory, then migrate your database:<br />
# RAILS_ENV=production REDMINE_LANG=pt-BR rake db:migrate<br />
<br />
If you have installed any plugins, you should also run their database migrations:<br />
# RAILS_ENV=production REDMINE_LANG=pt-BR rake redmine:plugins:migrate<br />
<br />
Now, it is time to clean the cache and the existing sessions:<br />
# rake tmp:cache:clear<br />
# rake tmp:sessions:clear<br />
<br />
Restart the application server (e.g. puma, thin, passenger, etc). And finally go to "Admin -> Roles & permissions" to check/set permissions for the new features, if any.<br />
<br />
==Troubleshooting==<br />
===RMagick gem without support for High Dynamic Range in ImageMagick===<br />
As of ImageMagick 6.8.6.8-1, it is built with HDRI (High Dynamic Range Image) support, and this breaks the RMagick gem as seen in {{Bug|36518}}.<br />
<br />
The github [https://github.com/rmagick/rmagick rmagick] is already patched, but the mantainer did not packed it for rubygems yet.<br />
<br />
To install this patched version download the git repository:<br />
# git clone https://github.com/rmagick/rmagick.git<br />
<br />
Then, you need to build the gem:<br />
# cd rmagick<br />
# gem build rmagick.gemspec<br />
<br />
And finally install it:<br />
# gem install rmagick-2.13.2.gem<br />
<br />
{{Note|It will show some complains like {{ic|unable to convert "\xE0" from ASCII-8BIT to UTF-8 for ext/RMagick/RMagick2.so, skipping}}, but you can safelly ignore it.}}<br />
<br />
===Runtime error complaining that RMagick was configured with older version===<br />
<br />
If you get the following runtime error after upgrading ImageMagick {{ic|This installation of RMagick was configured with ImageMagick 6.8.7 but ImageMagick 6.8.8-1 is in use.}} then you only need to reinstall (or rebuild as shown above if is the case).<br />
<br />
{{Note|This is due to that when you install the RMagick gem it compiles some native extensions and they may need to be rebuilt after some ImageMagick upgrades.}}<br />
<br />
===Error when installing gems: Cannot load such file -- mysql2/mysql2===<br />
<br />
If you see an error like {{ic| cannot load such file -- mysql2/mysql2}}, you are having a problem with the installation of the database gem. Probably a misconfiguration in the [[#Database Access Configuration|Database Access Configuration]] step.<br />
In this case you should verify the {{ic|database.yml}} file.<br />
<br />
If no success, you can manually install the database gem by:<br />
<br />
# gem install mysql2<br />
<br />
In last case, as suggested by [[User:Bobdog|Bobdog]], you can try to comment the line of the database gem and add a new one as bellow:<br />
<br />
{{hc|<path-to-mysql2-gem-directory>/lib/mysql2/mysql2.rb|<br />
<br />
# require 'mysql2/mysql2'<br />
require '<path-to-mysql2-gem-directory>/lib/mysql2/mysql2.so'}}<br />
<br />
=== Apache 2.4 Updating ===<br />
<br />
When updating to Apache 2.4 will be necessary to remove and install all your gems to make sure all of them that need to build native extensions will be rebuilt against the new Apache server.<br />
<br />
So, for a clean gems environment, remove all the gems:<br />
<br />
# for x in `gem list --no-versions`; do gem uninstall $x -a -x -I; done<br />
<br />
To reinstall the gems:<br />
<br />
# cd /usr/share/webapps/redmine<br />
# gem install bundler<br />
# bundle install --without development test<br />
<br />
Remember to reinstall the RMagick gem as describe above in [[#RMagick gem without support for High Dynamic Range in ImageMagick|RMagick gem without support for High Dynamic Range in ImageMagick]].<br />
<br />
And if you are using Passenger to serve your apps through Apache you will need to reinstall it as described above in [[#Configure the production server|Configure the production server]].<br />
<br />
=== Checkout SVN Source ===<br />
Get the Redmine source ([http://www.redmine.org/projects/redmine/wiki/Download Download instructions]). Here is method of installing Redmine directly from subversion in /srv/http/redmine/<br />
# useradd -d /srv/http/redmine -s /bin/false redmine<br />
# mkdir -p /srv/http/redmine<br />
# svn checkout http://svn.redmine.org/redmine/branches/2.1-stable /srv/http/redmine<br />
# chown -R redmine: /srv/http/redmine<br />
<br />
=== Automating The Update Process ===<br />
Example of an after-update script:<br />
<br />
#!/usr/bin/bash<br />
export RAILS_ENV=production<br />
grep -E "^gem 'thin'" Gemfile || echo "gem 'thin'" >> Gemfile<br />
bundle update && bundle exec rake generate_secret_token db:migrate redmine:plugins:migrate tmp:cache:clear tmp:sessions:clear<br />
<br />
{{Note| Note that this script uses Thin as application server, so you must change it to your needs.}}<br />
<br />
=== Creating a Systemd Unit===<br />
If you want to automatic run you application server when system starts, you need to create a systemd unit file.<br />
<br />
{{Note| This is not needed if you use {{Pkg|apache}} or {{Pkg|nginx}} with Passenger gem. Those servers already have their own unit file, so you have only to enable it.}}<br />
<br />
{{hc|/etc/systemd/system/redmine.service|<nowiki><br />
[Unit]<br />
Description=Redmine server<br />
After=syslog.target<br />
After=network.target<br />
<br />
[Service]<br />
Type=simple<br />
User=redmine2<br />
Group=redmine2<br />
Environment=GEM_HOME=/home/redmine2/.gem/<br />
ExecStart=/usr/bin/ruby /usr/share/webapps/redmine/script/rails server webrick -e production<br />
<br />
# Give a reasonable amount of time for the server to start up/shut down<br />
TimeoutSec=300<br />
<br />
[Install]<br />
WantedBy=multi-user.target<br />
<br />
</nowiki>}}<br />
<br />
=== Complaints about psych===<br />
<br />
Like that:<br />
<br />
/usr/lib/ruby/2.1.0/psych/parser.rb:33:in `<class:Parser>': superclass mismatch for class Mark (TypeError)<br />
from /usr/lib/ruby/2.1.0/psych/parser.rb:32:in `<module:Psych>'<br />
from /usr/lib/ruby/2.1.0/psych/parser.rb:1:in `<top (required)>'<br />
from /usr/lib/ruby/2.1.0/psych.rb:7:in `require'<br />
<br />
[http://www.redmine.org/boards/2/topics/36728 according to that] that is a bundler issue, and you have to add<br />
gem 'psych'<br />
to your Gemfile.local<br />
<br />
== See also ==<br />
<br />
* [http://www.redmine.org/ Redmine Official Site]<br />
* [http://www.redmine.org/projects/redmine/wiki/Features Redmine Features]<br />
* [http://www.redmine.org/projects/redmine/wiki/RedmineInstall Official install guide from Redmine Wiki]</div>Intrixiushttps://wiki.archlinux.org/index.php?title=Ruby_on_Rails&diff=327632Ruby on Rails2014-07-30T10:09:39Z<p>Intrixius: Added note about the http block</p>
<hr />
<div>[[Category:Web Server]]<br />
[[zh-CN:Ruby on Rails]]<br />
[http://rubyonrails.org/ Ruby on Rails], often shortened to Rails or RoR, is an open source web application framework for the Ruby programming language. It is intended to be used with an Agile development methodology that is used by web developers for rapid development.<br />
<br />
This document describes how to set up the Ruby on Rails Framework on an Arch Linux system.<br />
<br />
== Installation ==<br />
<br />
Ruby on Rails requires [[Ruby]] to be installed, so read that article first for installation instructions. The {{pkg|nodejs}} package is also required.<br />
<br />
Ruby on Rails itself can be installed multiple ways:<br />
<br />
=== Option A: via RubyGems ===<br />
<br />
{{Note|You can also install Rails system-wide using Gems. To do this, run the following commands as root and append them with {{ic|--no-user-install}}. Please read [[Ruby#Installing gems per-user or system-wide]] for possible dangers of using RubyGem in this way.}}<br />
<br />
The following command will install Rails for the current user:<br />
$ gem install rails<br />
<br />
Building the documentation takes a while. If you want to skip it, append {{ic|--no-document}} to the install command.<br />
$ gem install rails --no-document<br />
<br />
gem is a package manager for Ruby modules, somewhat like pacman is to Arch Linux. To update your gems, simply run:<br />
$ gem update<br />
<br />
=== Option B: via pacgem ===<br />
<br />
You can install Rails using {{AUR|pacgem}} from the [[AUR]]. Pacgem automatically creates PKGBUILDs and Arch packages for each of the gems. These packages will then be installed using pacman.<br />
# pacgem rails<br />
<br />
The gem packages can be updated with<br />
# pacgem -u<br />
<br />
=== Option C: from the AUR ===<br />
<br />
{{Warning|This is not recommended, as this might not include the latest Rails version, and additional dependencies may be introduced that may require you to run {{Ic|gem install}} anyway.}}<br />
<br />
There is a {{AUR|ruby-rails}} package available in the [[AUR]].<br />
<br />
=== Option D: from Quarry binary repository ===<br />
<br />
[[pacman|Install]] ''ruby-rails'' from the unofficial [[Unofficial user repositories#quarry|quarry]] repository.<br />
<br />
== Configuration ==<br />
<br />
Rails is bundled with a basic HTTP server called WeBrick. You can create a test application to test it. First, create an application with the rails command:<br />
<br />
$ rails new testapp_name<br />
<br />
{{Note|If you get an error like {{ic|Errno::ENOENT: No such file or directory (...) An error occurred while installing x, and Bundler cannot continue.}}, you might have to configure [[Ruby#Bundler|Bundler]] so that it installs gems per-user and not system-wide. Alternatively, run {{ic|# rails new testapp_name}} once as root. If it has completed successfully, delete {{ic|testapp_name/}} and run {{ic|$ rails new testapp_name}} again as a regular user.}}<br />
{{Note|If you get an error message like this:<br />
{{ic|... FetchError: SSL_connect returned&#61;1 errno&#61; 0 state&#61;SSLv2/v3 read server hello A: sslv3 alert handshake<br />
failure (https://s3.amazonaws.com/ production.s3.rubygems.org/gems/rake-10.0.3.gem) }}<br />
install {{Pkg|nodejs}} and try again.}}<br />
<br />
This creates a new folder inside your current working directory. <br />
<br />
$ cd testapp_name<br />
<br />
Next start the web server. It listens on port 3000 by default:<br />
<br />
$ rails server<br />
<br />
Now visit the testapp_name website on your local machine by opening http://localhost:3000 in your browser<br />
{{Note|If Ruby complains about not being able to find a JavaScript runtime, install {{Pkg|nodejs}}.}}<br />
<br />
A test-page should shown greeting you "Welcome aboard".<br />
<br />
== Application servers ==<br />
<br />
The built-in Ruby On Rails HTTP server (WeBrick) is convenient for basic development, but it is not recommended for production use. Instead, you should use an application server such as [[#Thin]], [[#Unicorn]] or [[#Apache/Nginx (using Phusion Passenger)|Phusion Passenger]].<br />
<br />
=== Thin ===<br />
<br />
[http://code.macournoyer.com/thin/ Thin]<br />
<br />
First install thin gem:<br />
$ gem install thin<br />
<br />
Then start it using:<br />
$ thin start<br />
<br />
=== Unicorn ===<br />
<br />
Unicorn is a stand-alone application server that cannot talk directly to clients. Instead, a web server must sit between clients and Unicorn, proxying requests as needed. [http://unicorn.bogomips.org/ Unicorn] is loosely based on Mongrel. It is used by Github, and it uses an architecture that tries hard to find the best child for handling a request. [https://github.com/blog/517-unicorn Explanation of differences between Unicorn and Mongrel].<br />
<br />
Install the Unicorn gem:<br />
# gem install unicorn<br />
<br />
Then create a configuration file for your application in {{ic|/etc/unicorn/}}. For example; here is a configuration example (Based on [http://www.warden.pl/2011/01/07/running-redmine-under-unicorn-in-debian/]) for Redmine:<br />
<br />
{{hc|/etc/unicorn/redmine.ru|<nowiki><br />
working_directory "/srv/http/redmine"<br />
pid "/tmp/redmine.pid"<br />
<br />
preload_app true<br />
timeout 60<br />
worker_processes 4<br />
listen 4000<br />
stderr_path('/var/log/unicorn.log')<br />
<br />
GC.respond_to?(:copy_on_write_friendly=) and GC.copy_on_write_friendly = true<br />
<br />
after_fork do |server, worker|<br />
#start the worker on port 4000, 4001, 4002 etc...<br />
addr = "0.0.0.0:#{4000 + worker.nr}"<br />
# infinite tries to start the worker<br />
server.listen(addr, :tries => -1, :delay => -1, :backlog => 128)<br />
<br />
#Drop privileges if running as root<br />
worker.user('nobody', 'nobody') if Process.euid == 0<br />
end<br />
</nowiki>}}<br />
<br />
Start it using:<br />
# usr/bin/unicorn -D -E production -c /etc/unicorn/redmine.ru<br />
<br />
==== Systemd service ====<br />
<br />
Put the following contents in {{ic|/etc/systemd/system/unicorn.service}}:<br />
{{hc|/etc/systemd/system/unicorn.service|2=<br />
[Unit]<br />
Description=Unicorn application server<br />
After=network.target<br />
<br />
[Service]<br />
Type=forking<br />
User=redmine<br />
ExecStart=/usr/bin/unicorn -D -E production -c /etc/unicorn/redmine.ru<br />
<br />
[Install]<br />
WantedBy=multi-user.target<br />
}}<br />
<br />
You can now easily start and stop unicorn using systemctl<br />
<br />
==== Nginx Configuration ====<br />
<br />
After setting up [[Nginx]], configure unicorn as an upstream server using something like this (Warning: this is a stripped example. It probably doesn't work without additional configuration):<br />
{{bc|1=<br />
http {<br />
upstream unicorn {<br />
server 127.0.0.1:4000 fail_timeout=0;<br />
server 127.0.0.1:4001 fail_timeout=0;<br />
server 127.0.0.1:4002 fail_timeout=0;<br />
server 127.0.0.1:4003 fail_timeout=0;<br />
}<br />
<br />
server {<br />
listen 80 default;<br />
server_name YOURHOSTNAMEHERE;<br />
<br />
location / {<br />
root /srv/http/redmine/public;<br />
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;<br />
proxy_set_header Host $http_host;<br />
proxy_redirect off;<br />
proxy_pass http://unicorn;<br />
}<br />
}<br />
}<br />
}}<br />
<br />
=== Apache/Nginx (using Phusion Passenger) ===<br />
<br />
[http://www.modrails.com/ Passenger] also known as {{ic|mod_rails}} is a module available for [[Nginx]] and [[Apache]], that greatly simplifies setting up a Rails server environment. Nginx does not support modules as Apache and has to be compiled with {{ic|mod_rails}} in order to support Passenger; let Passenger compile it for you. As for Apache, let Passenger set up the module for you.<br />
<br />
{{note|The current Nginx package in the official repositories actually is compiled with the Passenger module, so you can install it via pacman. The configuration files are stored in {{ic|/etc/nginx/conf/}}.}}<br />
{{note|As of 2013-10-07 this doesn't seem to be the case any longer and you will have to follow the remaining steps here}}<br />
<br />
Start by installing the 'passenger' gem:<br />
# gem install passenger<br />
<br />
If you are aiming to use [[Apache]], run:<br />
# passenger-install-apache2-module<br />
<br />
In case a rails application is deployed with a sub-URI, like http://example.com/yourapplication, some additional configuration is required, see [http://www.modrails.com/documentation/Users%20guide%20Apache.html#deploying_rails_to_sub_uri the modrails documentation]<br />
<br />
For [[Nginx]]:<br />
# passenger-install-nginx-module<br />
<br />
The installer will provide you with any additional information regarding the installation (such as installing additional libraries).<br />
<br />
To serve an application with Nginx, configure it as follows:<br />
<pre><br />
server {<br />
server_name app.example.org;<br />
root path_to_app/public; # Be sure to point to 'public' folder!<br />
passenger_enabled on;<br />
rails_env development; # Rails environment.<br />
}<br />
</pre><br />
<br />
== Databases ==<br />
<br />
Most web applications will need to interact with some sort of database. ActiveRecord (the ORM used by Rails to provide database abstraction) supports several database vendors, the most popular of which are MySQL, SQLite, and PostgreSQL.<br />
<br />
=== SQLite ===<br />
<br />
SQLite is the default lightweight database for Ruby on Rails. To enable SQLite, simply install {{Pkg|sqlite}}.<br />
<br />
=== PostgreSQL ===<br />
<br />
Install {{Pkg|postgresql}}.<br />
<br />
=== MySQL ===<br />
<br />
First, install and configure a MySQL server. Please refer to [[MySQL]] on how to do this.<br />
<br />
A gem with some native extensions is required, probably best installed as root:<br />
# gem install mysql<br />
<br />
You can generate a rails application configured for MySQL by using the {{ic|-d}} parameter:<br />
$ rails new testapp_name -d mysql<br />
<br />
You then need to edit {{ic|config/database.yml}}. Rails uses different databases for development, testing, production and other environments. Here is an example development configuration for MySQL running on localhost:<br />
<br />
development:<br />
adapter: mysql<br />
database: my_application_database<br />
username: development<br />
password: my_secret_password<br />
<br />
Note that you do not have to actually create the database using MySQL, as this can be done via Rails with:<br />
# rake db:create<br />
<br />
If no errors are shown, then your database has been created and Rails can talk to your MySQL database.<br />
<br />
== The Perfect Rails Setup ==<br />
<br />
''Phusion Passenger running multiple Ruby versions.''<br />
<br />
* [https://www.archlinux.org/ Arch Linux]: A simple, lightweight distribution. ;)<br />
* [http://www.nginx.org/ Nginx]: A fast and lightweight '''web server''' with a strong focus on high concurrency, performance and low memory usage.<br />
* [http://www.modrails.com/ Passenger] (a.k.a. mod_rails or mod_rack): Supports both Apache and Nginx web servers. It makes deployment of Ruby web applications, such as those built on Ruby on Rails web framework, a breeze.<br />
* [https://rvm.io/ Ruby Version Manager] (RVM): A command-line tool which allows you to easily install, manage, and work with multiple Ruby environments from interpreters to sets of gems. RVM lets you deploy each project with its own completely self-contained and dedicated environment —from the specific version of ruby, all the way down to the precise set of required gems to run your application—.<br />
* [http://sqlite.org/ SQLite]: The default lightweight '''database''' for Ruby on Rails.<br />
<br />
=== Step 0: SQLite ===<br />
<br />
Install {{Pkg|sqlite}}.<br />
<br />
{{note|Of course SQLite is not critical in this setup, you can use MySQL and PostgreSQL as well.}}<br />
<br />
=== Step 1: RVM ===<br />
<br />
Make a multi-user [[RVM]] installation as specified [[RVM#Multi-user_installation|here]].<br />
<br />
In the 'adding users to the rvm group' step, do<br />
# usermod -a -G rvm http<br />
# usermod -a -G rvm nobody<br />
<br />
{{ic|http}} and {{ic|nobody}} are the users related to Nginx and Passenger, respectively.<br />
<br />
{{note|Maybe adding the 'nobody' user to the 'rvm' group is not necessary.}}<br />
<br />
=== Step 2: Rubies ===<br />
<br />
Once you have a working RVM installation in your hands, it is time to install the latest Ruby interpreter<br />
{{Note|During the installation of Ruby patches will be applied. Consider installing the {{ic|base-devel}} group beforehand.}}<br />
<br />
$ rvm install 2.0.0<br />
<br />
{{Note| It may be useful to delete the 'global' gemsets of the environments that have web applications. Their gems might somehow interfere with Passenger. In that case, a {{ic|rvm 2.0.0 do gemset delete global}} is sufficient.}}<br />
<br />
=== Step 3: Nginx with Passenger support ===<br />
<br />
Run the following to allow passenger install nginx:<br />
$ rvm use 2.0.0 <br />
$ gem install passenger<br />
$ rvmsudo passenger-install-nginx-module<br />
<br />
The passenger gem will be put into the ''default'' gemset.<br />
<br />
This will download the sources of Nginx, compile and install it for you. It will guide you through all the process. Note that the default location for Nginx will be {{ic|/opt/nginx}}.<br />
<br />
{{Note|If you encounter a compilation error regarding Boost threads, see [https://bbs.archlinux.org/viewtopic.php?id&#61;139164 this] article.}}<br />
<br />
After completion, add the following two lines into the 'http block' at {{ic|/opt/nginx/conf/nginx.conf}} that look like:<br />
<br />
http { <br />
...<br />
passenger_root /usr/local/rvm/gems/ruby-2.0.0-p353/gems/passenger-3.0.9;<br />
passenger_ruby /usr/local/rvm/wrappers/ruby-2.0.0-p353/ruby;<br />
...<br />
}<br />
<br />
{{Note|This step is currently being done automatically by the installer script.}}<br />
<br />
=== Step 4: Gemsets and Apps ===<br />
<br />
For each Rails application you should have a gemset. Suppose that you want to try [http://refinerycms.com RefineryCMS] against [http://www.browsercms.org BrowserCMS], two open-source Content Management Systems based on Rails.<br />
<br />
Install RefineryCMS first:<br />
<br />
$ rvm use 2.0.0@refinery --create<br />
$ gem install rails -v 4.0.1<br />
$ gem install passenger<br />
$ gem install refinerycms refinerycms-i18n sqlite3<br />
<br />
Deploy a RefineryCMS instance called ''refineria'':<br />
<br />
$ cd /srv/http/<br />
$ rvmsudo refinerycms refineria<br />
<br />
Install BrowserCMS in a different gemset:<br />
<br />
$ rvm use 2.0.0@browser --create<br />
$ gem install rails -v 4.0.1<br />
$ gem install passenger<br />
$ gem install browsercms sqlite3<br />
<br />
Deploy a BrowserCMS instance called ''navegador'':<br />
<br />
$ cd /srv/http/<br />
$ rvmsudo browsercms demo navegador<br />
$ cd /srv/http/navegador<br />
$ rvmsudo rake db:install<br />
<br />
=== Passenger for Nginx and Passenger Standalone ===<br />
<br />
Observe that the passenger gem was installed three times and with different intentions; in the environments<br />
* ''2.0.0'' => for Nginx,<br />
* ''2.0.0@refinery'' => Standalone<br />
* ''2.0.0@browser'' => Standalone<br />
<br />
The strategy is to combine Passenger for Nginx with Passenger Standalone. One must first identify the Ruby environment (interpreter plus gemset) that one uses the most; in this setup the Ruby interpreter and the default gemset were selected. One then proceeds with setting up Passenger for Nginx to use that environment (step 3).<br />
* Applications within the chosen environment can be served as in [[Ruby_on_Rails#Apache.2FNginx_.28using_Phusion_Passenger.29|Apache/Nginx (using Phusion Passenger)]], page up in this article.<br />
* All applications that are to use a different Ruby version and/or gemset can be served separately through Passenger Standalone and hook into the main web server via a reverse proxy configuration (step 6).<br />
<br />
=== Step 5: .rvmrc files and ownerships ===<br />
<br />
This step is crucial for the correct behaviour of the setup. RVM seeks for .rvmrc files when changing folders; if it finds one, it reads it. In these files normally one stores a line like<br />
rvm <ruby_version>@<gemset_name><br />
so the specified environment is set at the entrance of applications' root folder.<br />
<br />
Create /srv/http/refineria/.rvmrc doing<br />
# echo "rvm ree@refinery" > /srv/http/refineria/.rvmrc<br />
, and /srv/http/navegador/.rvmrc with<br />
# echo "rvm 2.0.0@browser" > /srv/http/navegador/.rvmrc<br />
You have to enter to both application root folders now, because every first time that RVM finds a .rvmrc it asks you if you trust the given file, consequently you must validate the two files you have just created.<br />
<br />
These files aid the programs involved to find the correct gems.<br />
<br />
Apart, if applications' files and folders are not owned by the right user you will face database write-access problems. The use of rvmsudo produces ''root''-owned archives when generated by Rails; in the other hand, ''nobody'' is the user for Passenger —if you have not changed it—: who will use and should posses them. Fix this doing<br />
# chown -R nobody.nobody /srv/http/refineria /srv/http/navegador<br />
<br />
=== Step 6: Reverse proxies ===<br />
<br />
You have to start the Passenger Standalone web servers for your applications. So, do<br />
$ cd /srv/http/refineria<br />
$ rvmsudo passenger start --socket tmp/sockets/passenger.socket -d<br />
and<br />
$ cd /srv/http/navegador<br />
$ rvmsudo passenger start --socket tmp/sockets/passenger.socket -d<br />
. The first time that you run a Passenger Standalone it will perform a minor installation.<br />
<br />
Note that you are using ''unix domain'' sockets instead of the commonly-used ''TCP'' sockets; it turns out that unix domain are significantly faster than TCP sockets.<br />
<br />
{{note|If you are experimenting trouble with unix sockets, changing to TCP should work:<br />
rvmsudo passenger start -a 127.0.0.1 -p 3000 -d<br />
}}<br />
<br />
==== Launch Passenger Standalone daemons at system start-up ====<br />
<br />
''Do you have a script? Please post it here.''<br />
<br />
The systemd script below was made for a Typo blog I host at /srv/http/typo. It's located at /etc/systemd/system/passenger_typo.service. I set the Environment= tags (see "man systemd.exec") from the output of "rvm env". The only exception was PATH=, which I had to combine from my regular PATH and the output of rvm env.<br />
<br />
Note: If you don't set the "WorkingDirectory=" variable to your application folder, passenger will fail to find your app and will subsequently shut itself down.<br />
<br />
<pre><br />
[Unit]<br />
Description=Passenger Standalone Script for Typo<br />
After=network.target<br />
<br />
[Service]<br />
Type=forking<br />
WorkingDirectory=/srv/http/typo<br />
PIDFile=/srv/http/typo/tmp/pids/passenger.pid<br />
<br />
Environment=PATH=/usr/local/rvm/gems/ruby-2.0.0-p0@typo/bin:/usr/local/rvm/gems/ruby-2.0.0-p0@global/bin:/usr/local/rvm/rubies/ruby-2.0.0-p0/bin:/usr/local/rvm/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/bin/core_perl<br />
Environment=rvm_env_string=ruby-2.0.0-p0@typo<br />
Environment=rvm_path=/usr/local/rvm<br />
Environment=rvm_ruby_string=ruby-2.0.0-p0<br />
Environment=rvm_gemset_name=typo<br />
Environment=RUBY_VERSION=ruby-2.0.0-p0<br />
Environment=GEM_HOME=/usr/local/rvm/gems/ruby-2.0.0-p0@typo<br />
Environment=GEM_PATH=/usr/local/rvm/gems/ruby-2.0.0-p0@typo:/usr/local/rvm/gems/ruby-2.0.0-p0@global<br />
Environment=MY_RUBY_HOME=/usr/local/rvm/rubies/ruby-2.0.0-p0<br />
Environment=IRBRC=/usr/local/rvm/rubies/ruby-2.0.0-p0/.irbrc<br />
<br />
ExecStart=/bin/bash -c "rvmsudo passenger start --socket /srv/http/typo/tmp/sockets/passenger.socket -d"<br />
<br />
[Install]<br />
WantedBy=multi-user.target<br />
</pre><br />
<br />
=== Step 7: Deployment ===<br />
<br />
==== With subdomains ====<br />
<br />
Once again edit /opt/nginx/conf/nginx.conf to include some vital instructions:<br />
<br />
<pre><br />
## RefineryCMS ##<br />
<br />
server {<br />
server_name refinery.domain.com;<br />
root /srv/http/refineria/public;<br />
location / {<br />
proxy_pass http://unix:/srv/http/refineria/tmp/sockets/passenger.socket;<br />
proxy_set_header Host $host;<br />
}<br />
}<br />
<br />
## BrowserCMS ##<br />
<br />
server {<br />
server_name browser.domain.com;<br />
root /srv/http/navegador/public;<br />
location / {<br />
proxy_pass http://unix:/srv/http/navegador/tmp/sockets/passenger.socket;<br />
proxy_set_header Host $host;<br />
}<br />
}<br />
</pre><br />
<br />
{{note|Or if using TCP sockets, configure the ''proxy_pass'' directive like<br />
<pre>proxy_pass http://127.0.0.1:3000;</pre><br />
}}<br />
<br />
==== Without subdomains ====<br />
<br />
If you for some reason don't want to host each application on it's own subdomain but rather in a url like: {{ic|site.com/railsapp}} then you could do something like this in your config:<br />
<br />
<pre><br />
server {<br />
server_name site.com;<br />
#Base for the html files etc<br />
root /srv/http/;<br />
<br />
#First application you want hosted under domain site.com/railsapp<br />
location /railsapp {<br />
root /srv/http/railsapp/public;<br />
#you may need to change passenger_base_uri to be the uri you want to point at, ie:<br />
#passenger_base_uri /railsapp;<br />
#but probably only if you're using the other solution with passenger phusion<br />
proxy_pass http://unix:/srv/http/railsapp/tmp/sockets/passenger.socket;<br />
proxy_set_header Host $host;<br />
}<br />
<br />
#Second applicatino you want hosted under domain site.com/anotherapp<br />
location /anotherapp {<br />
root /srv/http/anotherapp/public;<br />
#same thing about the passenger_base_uri here, but with value /anotherapp instead<br />
proxy_pass http://unix:/srv/http/anotherapp/tmp/sockets/passenger.socket;<br />
proxy_set_header Host $host;<br />
}<br />
}<br />
</pre><br />
<br />
At this point you are in conditions to run Nginx with:<br />
<br />
# systemctl start nginx<br />
<br />
and to access both CMSs through ''refinery.domain.com'' and ''browser.domain.com''.<br />
<br />
=== References ===<br />
<br />
* http://beginrescueend.com/integration/passenger<br />
* http://blog.phusion.nl/2010/09/21/phusion-passenger-running-multiple-ruby-versions<br />
<br />
== See also ==<br />
<br />
* [[Ruby]]<br />
* [[Nginx]]<br />
* [[LAMP]]<br />
* [[MySQL]]<br />
<br />
== References ==<br />
<br />
* Ruby on Rails http://rubyonrails.org/download.<br />
* Mongrel http://mongrel.rubyforge.org.</div>Intrixiushttps://wiki.archlinux.org/index.php?title=Beginners%27_guide&diff=292185Beginners' guide2014-01-10T09:45:04Z<p>Intrixius: /* Dynamic IP */ Added a note about the message after performing netctl enable</p>
<hr />
<div><noinclude><br />
[[Category:Getting and installing Arch]]<br />
[[Category:About Arch]]<br />
[[ar:Beginners' Guide/Installation]]<br />
[[da:Beginners' Guide/Installation]]<br />
[[el:Beginners' Guide/Installation]]<br />
[[es:Beginners' Guide/Installation]]<br />
[[hr:Beginners' Guide/Installation]]<br />
[[hu:Beginners' Guide/Installation]]<br />
[[it:Beginners' Guide/Installation]]<br />
[[ja:Beginners' Guide/Installation]]<br />
[[ko:Beginners' Guide/Installation]]<br />
[[nl:Beginners' Guide/Installatie]]<br />
[[pl:Beginners' Guide/Installation]]<br />
[[pt:Beginners' Guide/Installation]]<br />
[[ro:Ghidul începătorilor/Instalare]]<br />
[[ru:Beginners' Guide/Installation]]<br />
[[sr:Beginners' Guide/Installation]]<br />
[[zh-CN:Beginners' Guide/Installation]]<br />
[[zh-TW:Beginners' Guide/Installation]]<br />
{{Tip|This is part of a multi-page article for The Beginners' Guide. '''[[Beginners' Guide|Click here]]''' if you would rather read the guide in its entirety.}}<br />
</noinclude><br />
== Installation ==<br />
<br />
You are now presented with a shell prompt, automatically logged in as root.<br />
<br />
=== Change the language ===<br />
<br />
{{Tip|These are optional for the majority of users. Useful only if you plan on writing in your own language in any of the configuration files, if you use diacritical marks in the Wi-Fi password, or if you would like to receive system messages (e.g. possible errors) in your own language.<br />
Changes here ''only'' affect the installation process.}}<br />
<br />
By default, the keyboard layout is set to {{ic|us}}. If you have a non-[[Wikipedia:File:KB United States-NoAltGr.svg|US]] keyboard layout, run:<br />
<br />
# loadkeys ''layout''<br />
<br />
...where ''layout'' can be {{ic|fr}}, {{ic|uk}}, {{ic|dvorak}}, {{ic|be-latin1}}, etc. See [[Wikipedia:ISO 3166-1 alpha-2#Officially assigned code elements|here]] for 2-letter country code list. Use the command {{ic|localectl list-keymaps}} to list all available keymaps.<br />
<br />
The font should also be changed, because most languages use more glyphs than the 26 letter [[Wikipedia:English alphabet|English alphabet]]. Otherwise some foreign characters may show up as white squares or as other symbols. Note that the name is case-sensitive, so please type it ''exactly'' as you see it:<br />
<br />
# setfont Lat2-Terminus16<br />
<br />
By default, the language is set to English (US). If you would like to change the language for the install process ''(German, in this example)'', remove the {{ic|#}} in front of the [[locale]] you want from {{ic|/etc/locale.gen}}, along with English (US). Please choose the {{ic|UTF-8}} entry.<br />
<br />
To edit using the simple Nano editor, type {{ic|nano /etc/locale.gen}} and make your changes. Use {{ic|Ctrl+X}} to exit, and when prompted to save changes, press {{ic|Y}} and {{ic|Enter}} to use the same filename.<br />
<br />
{{hc|# nano /etc/locale.gen|<br />
en_US.UTF-8 UTF-8<br />
de_DE.UTF-8 UTF-8}}<br />
<br />
# locale-gen<br />
# export LANG=de_DE.UTF-8<br />
<br />
=== Establish an internet connection ===<br />
<br />
{{Warning|As of v197, udev no longer assigns network interface names according to the wlanX and ethX naming scheme. If you are coming from a different distribution or are reinstalling Arch and not aware of the new interface naming style, please do not assume that your wireless interface is named wlan0, or that your wired interface is named eth0. You can use the command {{ic|ip link}} to discover the names of your interfaces.}}<br />
<br />
The {{ic|dhcpcd}} network daemon starts automatically during boot and it will attempt to start a wired connection. Try to ping a server to see if a connection was established. For example, Google's webservers:<br />
<br />
{{hc|# ping -c 3 www.google.com|2=<br />
PING www.l.google.com (74.125.132.105) 56(84) bytes of data.<br />
64 bytes from wb-in-f105.1e100.net (74.125.132.105): icmp_req=1 ttl=50 time=17.0 ms<br />
64 bytes from wb-in-f105.1e100.net (74.125.132.105): icmp_req=2 ttl=50 time=18.2 ms<br />
64 bytes from wb-in-f105.1e100.net (74.125.132.105): icmp_req=3 ttl=50 time=16.6 ms<br />
<br />
--- www.l.google.com ping statistics ---<br />
3 packets transmitted, 3 received, 0% packet loss, time 2003ms<br />
rtt min/avg/max/mdev = 16.660/17.320/18.254/0.678 ms}}<br />
<br />
If you get a {{ic|ping: unknown host}} error, first check if there is an issue with your cable or wireless signal strength. If not, you will need to set up the network manually, as explained below. Once a connection is established move on to [[#Prepare the storage drive|Prepare the storage drive]].<br />
<br />
==== Wired ====<br />
<br />
Follow this procedure if you need to set up a wired connection via a static IP address.<br />
<br />
First, disable the dhcpcd service which was started automatically at boot:<br />
<br />
# systemctl stop dhcpcd.service<br />
<br />
Identify the name of your Ethernet interface.<br />
<br />
{{hc|# ip link|<br />
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT<br />
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00<br />
2: enp2s0f0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT qlen 1000<br />
link/ether 00:11:25:31:69:20 brd ff:ff:ff:ff:ff:ff<br />
3: wlp3s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DORMANT qlen 1000<br />
link/ether 01:02:03:04:05:06 brd ff:ff:ff:ff:ff:ff}}<br />
<br />
In this example, the Ethernet interface is {{ic|enp2s0f0}}. If you are unsure, your Ethernet interface is likely to start with the letter "e", and unlikely to be "lo" or start with the letter "w".<br />
<br />
You also need to know these settings:<br />
<br />
* Static IP address.<br />
* Subnet mask.<br />
* Gateway's IP address.<br />
* Name servers' (DNS) IP addresses.<br />
* Domain name (unless you are on a local LAN, in which case you can make it up).<br />
<br />
Activate the connected Ethernet interface (e.g. {{ic|enp2s0f0}}):<br />
<br />
# ip link set enp2s0f0 up<br />
<br />
Add the address:<br />
<br />
# ip addr add ''ip_address''/''mask_bits'' dev ''interface_name''<br />
<br />
For example:<br />
<br />
# ip addr add 192.168.1.2/24 dev enp2s0f0<br />
<br />
For more options, run {{ic|man ip}}.<br />
<br />
Add your gateway like this, substituting your own gateway's IP address:<br />
<br />
# ip route add default via ''ip_address''<br />
<br />
For example:<br />
<br />
# ip route add default via 192.168.1.1<br />
<br />
Edit {{ic|resolv.conf}}, substituting your name servers' IP addresses and your local domain name:<br />
<br />
{{hc|# nano /etc/resolv.conf|<br />
nameserver 61.23.173.5<br />
nameserver 61.95.849.8<br />
search example.com}}<br />
<br />
{{Note|Currently, you may include a maximum of three {{ic|nameserver}} lines. In order to overcome this limitation, you can use a locally caching nameserver like [[Dnsmasq]]. }}<br />
<br />
You should now have a working network connection. If you do not, check the detailed [[Network Configuration]] page.<br />
<br />
==== Wireless ====<br />
<br />
Follow this procedure if you need wireless connectivity (Wi-Fi) during the installation process.<br />
<br />
First, identify the name of your wireless interface.<br />
<br />
{{hc|# iw dev|2=<br />
phy#0<br />
Interface wlp3s0<br />
ifindex 3<br />
wdev 0x1<br />
addr 00:11:22:33:44:55<br />
type managed<br />
}}<br />
<br />
In this example, {{ic|wlp3s0}} is the available wireless interface. If you are unsure, your wireless interface is likely to start with the letter "w", and unlikely to be "lo" or start with the letter "e". <br />
<br />
{{Note|If you do not see output similar to this, then your wireless driver has not been loaded. If this is the case, you must load the driver yourself. Please see [[Wireless Setup]] for more detailed information.}}<br />
<br />
Bring the interface up with:<br />
<br />
# ip link set wlp3s0 up<br />
<br />
To verify that the interface is up, inspect the output of the following command:<br />
<br />
{{hc|# ip link show wlp3s0|<br />
3: wlp3s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state DOWN mode DORMANT group default qlen 1000<br />
link/ether 00:11:22:33:44:55 brd ff:ff:ff:ff:ff:ff<br />
}}<br />
<br />
The {{ic|UP}} in {{ic|<BROADCAST,MULTICAST,UP,LOWER_UP>}} is what indicates the interface is up, not the later {{ic|state DOWN}}.<br />
<br />
Most wireless chipsets require firmware in addition to a corresponding driver. The kernel tries to identify and load both automatically. If you get output like {{ic|SIOCSIFFLAGS: No such file or directory}}, this means you will need to manually load the firmware. If unsure, invoke {{ic|dmesg}} to query the kernel log for a firmware request from the wireless chipset. For example, if you have an Intel chipset which requires and has requested firmware from the kernel at boot:<br />
<br />
{{hc|# dmesg <nowiki>|</nowiki> grep firmware|<br />
firmware: requesting iwlwifi-5000-1.ucode}}<br />
<br />
If there is no output, it may be concluded that the system's wireless chipset does not require firmware.<br />
<br />
{{Warning|Wireless chipset firmware packages (for cards which require them) are pre-installed under {{ic|/usr/lib/firmware}} in the live environment (on CD/USB stick) '''but must be explicitly installed to your actual system to provide wireless functionality after you reboot into it!''' Package installation is covered later in this guide. Ensure installation of both your wireless module and firmware before rebooting! See [[Wireless Setup]] if you are unsure about the requirement of corresponding firmware installation for your particular chipset.}}<br />
<br />
Next, use [[netctl]]'s {{ic|wifi-menu}} to connect to a network:<br />
<br />
# wifi-menu wlp3s0<br />
<br />
You should now have a working network connection. If you do not, check the detailed [[Wireless Setup]] page.<br />
<br />
===== Without wifi-menu =====<br />
<br />
Alternatively, use {{ic|iw dev wlp3s0 scan <nowiki>|</nowiki> grep SSID}} to scan for available networks, then connect to a network with:<br />
<br />
# wpa_supplicant -B -i wlp3s0 -c <(wpa_passphrase "''ssid''" "''psk''")<br />
<br />
You need to replace ''ssid'' with the name of your network (e.g. "Linksys etc...") and ''psk'' with your wireless password, '''leaving the quotes around the network name and password.'''<br />
<br />
Finally, you have to give your interface an IP address. This can be set manually or using the dhcp:<br />
<br />
# dhcpcd wlp3s0<br />
<br />
If that does not work, issue the following commands:<br />
<br />
# echo 'ctrl_interface=DIR=/run/wpa_supplicant' > /etc/wpa_supplicant.conf<br />
# wpa_passphrase <ssid> <passphrase> >> /etc/wpa_supplicant.conf<br />
# ip link set <interface> up # May not be needed, but does no harm in any case<br />
# wpa_supplicant -B -D nl80211 -c /foobar.conf -i <interface name><br />
# dhcpcd -A <interface name><br />
<br />
==== Analog modem, ISDN or PPPoE DSL ====<br />
<br />
For xDSL, dial-up and ISDN connections, see [[Direct Modem Connection]].<br />
<br />
==== Behind a proxy server ====<br />
<br />
If you are behind a proxy server, you will need to export the {{ic|http_proxy}} and {{ic|ftp_proxy}} environment variables. See [[Proxy settings]] for more information.<br />
<br />
=== Prepare the storage drive ===<br />
<br />
{{Warning|Partitioning can destroy data. You are '''strongly''' cautioned and advised to backup any critical data before proceeding.}}<br />
<br />
==== Choose a partition table type ====<br />
<br />
You have to choose between [[GUID Partition Table]] (GPT) and [[Master Boot Record]] (MBR). GPT is more modern and recommended for new installations.<br />
<br />
* If you want to setup a system which dual boots with windows, then you have to pay special attention to this choice. See [[Partitioning#Choosing between GPT and MBR]] for the gory details.<br />
* It is recommended to always use GPT for UEFI boot, as some UEFI firmwares do not allow UEFI-MBR boot.<br />
* Some BIOS systems may have issues with GPT. See http://mjg59.dreamwidth.org/8035.html and http://rodsbooks.com/gdisk/bios.html for more info and possible workarounds.<br />
<br />
{{Note|If you are installing to a USB flash key, see [[Installing Arch Linux on a USB key]].}}<br />
<br />
==== Partitioning tool ====<br />
<br />
Absolute beginners are encouraged to use a graphical partitioning tool. [http://gparted.sourceforge.net/download.php GParted] is a good example, and is [http://gparted.sourceforge.net/livecd.php provided as a "live" CD]. It is also included on live CDs of most Linux distributions such as [[Wikipedia:Ubuntu (operating system)|Ubuntu]] and [[Wikipedia:Linux Mint|Linux Mint]]. A drive should first be [[partitioning|partitioned]] and the partitions should be formatted with a [[File Systems|file system]] before rebooting.<br />
<br />
{{Tip|When using Gparted, selecting the option to create a new partition table gives an "msdos" partition table by default. If you are intending to follow the advice to create a GPT partition table then you need to choose "Advanced" and then select "gpt" from the drop-down menu.}}<br />
<br />
While gparted may be easier to use, if you just want to create a few partitions on a new disk you can get the job done quickly by just using one of the [[Partitioning#Partitioning tools|fdisk variants]] which are included on the install medium. There are short usage instructions for both [[Partitioning#Gdisk usage summary|gdisk]] and [[Partitioning#Fdisk usage summary|fdisk]].<br />
<br />
==== Partition scheme ====<br />
<br />
You can decide into how many partitions the disk should be split, and for which directory each partition should be used in the system. The mapping from partitions to directories (frequently called 'mount points') is the [[Partitioning#Partition scheme|Partition scheme]]. The simplest, and not a bad choice, is to make just one huge {{ic|/}} partition. Another popular choice is to have a {{ic|/}} and a {{ic|/home}} partition.<br />
<br />
'''Additional required partitions:'''<br />
* If you have a [[UEFI]] motherboard, you will need to create an extra [[Unified Extensible Firmware Interface#EFI System Partition|EFI System Partition]].<br />
* If you have a BIOS motherboard (or plan on booting in BIOS compatibility mode) and you want to setup GRUB on a GPT-partitioned drive, you will need to create an extra [[GRUB#GUID Partition Table (GPT) specific instructions|BIOS Boot Partition]] of size 1 or 2 MiB and {{ic|EF02}} type code. Syslinux does not need one.<br />
* If you have a requirement for a [[Disk encryption]] of the system itself, this must be reflected in your partition scheme. It is unproblematic to add encrypted folders, containers or home directories after the system is installed.<br />
* If you are planning to use any filesystem for root filesystem different than ext4 (such as [[F2fs | F2fs]]), you should check first if GRUB supports it. If it is not supported you need to create a GRUB compatible partition (such as [[Ext4|ext4]]) and use it for {{ic|/boot}}.<br />
<br />
See [[Swap]] for details if you wish to set up a swap partition or swap file. A swap file is easier to resize than a partition and can be created at any point after installation, but cannot be used with a Btrfs filesystem.<br />
<br />
==== Considerations for dualbooting with Windows ====<br />
<br />
If you have an existing OS installation, please keep in mind that if you were to just write a completely new partition table to disk then all the data which was previously on disk would be lost. <br />
<br />
The recommended way to setup a Linux/Windows dual booting system is to first install Windows, only using part of the disk for its partitions. When you have finished the Windows setup, boot into the Linux install environment where you can create additional partitions for Linux while leaving the existing Windows partitions untouched.<br />
<br />
Some newer computers come pre-installed with Windows 8 which will be using Secure Boot. Arch Linux currently does not support Secure Boot, but some Windows 8 installations have been seen not to boot if Secure Boot is turned off in the BIOS. In some cases it is necessary to turn off both Secure Boot as well as Fastboot in the BIOS options in order to allow Windows 8 to boot without Secure Boot. However there are potential security risks in turning off Secure Boot for booting up Windows 8. Therefore, it may be a better option to keep the Windows 8 install intact and have an independent hard drive for the Linux install - which can then be partitioned from scratch using a GPT partition table. Once that is done, creating several ext4/FAT32/swap partitions on the second drive may be a better way forward if the computer has two drives available. This is often not easy or possible on a small laptop. Currently, Secure Boot is still not in a fully stable state for reliable operation, even for Linux distributions that support it.<br />
<br />
{{Warning|Windows 8 includes a new feature called Fast Startup, which turns shutdown operations into suspend-to-disk operations. The result is that filesystems shared between Windows 8 and any other OS are almost certain to be damaged when booting between the two OSes. Even if you don't intend to share filesystems, the EFI System Partition is likely to be damaged on an EFI system. Therefore, you should disable Fast Startup, as described [http://www.eightforums.com/tutorials/6320-fast-startup-turn-off-windows-8-a.html here,] before you install Linux on any computer that uses Windows 8.}}<br />
<br />
If you have already created your partitions, proceed to [[#Create filesystems]].<br />
<br />
Otherwise, see the following example.<br />
<br />
==== Example ====<br />
<br />
The Arch Linux install media includes the following partitioning tools: {{ic|fdisk}}, {{ic|gdisk}}, {{ic|cfdisk}}, {{ic|cgdisk}}, {{ic|parted}}.<br />
<br />
{{Tip|Use the {{ic|lsblk}} command to list the hard disks attached to your system, along with the sizes of their existing partitions. This will help you to be confident you are partitioning the right disk.}}<br />
<br />
The example system will contain a 15 GB root partition, and a [[Partitioning#/home|home]] partition for the remaining space. Choose either [[MBR]] or [[GPT]]. Do not choose both!<br />
<br />
It should be emphasized that partitioning is a personal choice and that this example is only for illustrative purposes. See [[Partitioning]].<br />
<br />
===== Using cgdisk to create GPT partitions =====<br />
<br />
# cgdisk&nbsp;/dev/sda<br />
<br />
;Root:<br />
* Choose ''New'' (or press {{ic|N}}) – {{ic|Enter}} for the first sector (2048) – type in {{ic|15G}} – {{ic|Enter}} for the default hex code (8300) – {{ic|Enter}} for a blank partition name.<br />
<br />
;Home:<br />
* Press the down arrow a couple of times to move to the larger free space area.<br />
* Choose ''New'' (or press {{ic|N}}) – {{ic|Enter}} for the first sector – {{ic|Enter}} to use the rest of the drive (or you could type in the desired size; for example {{ic|30G}}) – {{ic|Enter}} for the default hex code (8300) – {{ic|Enter}} for a blank partition name.<br />
<br />
Here is what it should look like:<br />
<br />
Part. # Size Partition Type Partition Name<br />
----------------------------------------------------------------<br />
1007.0 KiB free space<br />
1 15.0 GiB Linux filesystem<br />
2 123.45 GiB Linux filesystem<br />
<br />
Double check and make sure that you are happy with the partition sizes as well as the partition table layout before continuing.<br />
<br />
If you would like to start over, you can simply select ''Quit'' (or press {{ic|Q}}) to exit without saving changes and then restart ''cgdisk''.<br />
<br />
If you are satisfied, choose ''Write'' (or press {{ic|Shift+W}}) to finalize and to write the partition table to the drive. Type {{ic|yes}} and choose ''Quit'' (or press {{ic|Q}}) to exit without making any more changes.<br />
<br />
===== Using fdisk to create MBR partitions =====<br />
{{Note|There is also ''cfdisk'', which is similar in UI to ''cgdisk'', but it currently does not automatically align the first partition properly. That is why the classic ''fdisk'' tool is used here.}}<br />
<br />
Launch ''fdisk'' with:<br />
<br />
# fdisk /dev/sda<br />
<br />
Create the partition table:<br />
<br />
* {{ic|Command (m for help):}} type {{ic|o}} and press {{ic|Enter}}<br />
<br />
Then create the first partition:<br />
<br />
# {{ic|Command (m for help):}} type {{ic|n}} and press {{ic|Enter}}<br />
# Partition type: {{ic|Select (default p):}} press {{ic|Enter}}<br />
# {{ic|Partition number (1-4, default 1):}} press {{ic|Enter}}<br />
# {{ic|First sector (2048-209715199, default 2048):}} press {{ic|Enter}}<br />
# {{ic|Last sector, +sectors or +size{K,M,G} (2048-209715199....., default 209715199):}} type {{ic|+15G}} and press {{ic|Enter}}<br />
<br />
Then create a second partition:<br />
<br />
# {{ic|Command (m for help):}} type {{ic|n}} and press {{ic|Enter}}<br />
# Partition type: {{ic|Select (default p):}} press {{ic|Enter}}<br />
# {{ic|Partition number (1-4, default 2):}} press {{ic|Enter}}<br />
# {{ic|First sector (31459328-209715199, default 31459328):}} press {{ic|Enter}}<br />
# {{ic|Last sector, +sectors or +size{K,M,G} (31459328-209715199....., default 209715199):}} press {{ic|Enter}}<br />
<br />
Now preview the new partition table:<br />
<br />
* {{ic|Command (m for help):}} type {{ic|p}} and press {{ic|Enter}}<br />
<br />
{{bc|<br />
Disk /dev/sda: 107.4 GB, 107374182400 bytes, 209715200 sectors<br />
Units &#61; sectors of 1 * 512 &#61; 512 bytes<br />
Sector size (logical/physical): 512 bytes / 512 bytes<br />
I/O size (minimum/optimal): 512 bytes / 512 bytes<br />
Disk identifier: 0x5698d902<br />
<br />
Device Boot Start End Blocks Id System<br />
/dev/sda1 2048 31459327 15728640 83 Linux<br />
/dev/sda2 31459328 209715199 89127936 83 Linux<br />
}}<br />
<br />
Then write the changes to disk:<br />
<br />
* {{ic|Command (m for help):}} type {{ic|w}} and press {{ic|Enter}}<br />
<br />
If everything went well fdisk will now quit with the following message:<br />
{{bc|<br />
The partition table has been altered!<br />
<br />
Calling ioctl() to re-read partition table.<br />
Syncing disks. <br />
}}<br />
<br />
In case this doesn't work because ''fdisk'' encountered an error, you can use the {{ic|q}} command to exit.<br />
<br />
==== Create filesystems ====<br />
<br />
Simply partitioning is not enough; the partitions also need a [[File Systems|filesystem]]. To format the partitions with an ext4 filesystem:<br />
<br />
{{Warning|Double check and triple check that it is actually {{ic|/dev/sda1}} and {{ic|/dev/sda2}} that you want to format. You can use {{ic|lsblk}} to help with this.}}<br />
<br />
# mkfs.ext4 /dev/sda1<br />
# mkfs.ext4 /dev/sda2<br />
<br />
If you have made a partition dedicated to swap (code 82), do not forget to format and activate it with:<br />
<br />
# mkswap /dev/sda''X''<br />
# swapon /dev/sda''X''<br />
<br />
For UEFI, you should format the EFI System Partition (for example /dev/sd''XY'') with:<br />
<br />
# mkfs.fat -F32 /dev/sd''XY''<br />
<br />
=== Mount the partitions ===<br />
<br />
Each partition is identified with a number suffix. For example, {{ic|sda1}} specifies the first partition of the first drive, while {{ic|sda}} designates the entire drive.<br />
<br />
To display the current partition layout:<br />
<br />
# lsblk /dev/sda<br />
<br />
{{Note|Do not mount more than one partition to the same directory. And pay attention, because the mounting order is important.}}<br />
<br />
First, mount the root partition on {{ic|/mnt}}. Following the example above (yours may be different), it would be:<br />
<br />
# mount /dev/sda1 /mnt<br />
<br />
Then mount the home partition and any other separate partition ({{ic|/boot}}, {{ic|/var}}, etc), if you have any:<br />
<br />
# mkdir /mnt/home<br />
# mount /dev/sda2 /mnt/home<br />
<br />
In case you have a UEFI motherboard, mount the EFI System Partition at your preferred mountpoint ({{ic|/boot}} used for example):<br />
<br />
# mkdir -p /mnt/boot<br />
# mount /dev/sd''XY'' /mnt/boot<br />
<br />
=== Select a mirror ===<br />
<br />
Before installing, you may want to edit the {{ic|mirrorlist}} file and place your preferred mirror first. A copy of this file will be installed on your new system by {{ic|pacstrap}} as well, so it is worth getting it right.<br />
<br />
{{hc|# nano /etc/pacman.d/mirrorlist|<br />
##<br />
## Arch Linux repository mirrorlist<br />
## Sorted by mirror score from mirror status page<br />
## Generated on 2012-MM-DD<br />
##<br />
<br />
<nowiki>Server = http://mirror.example.xyz/archlinux/$repo/os/$arch</nowiki><br />
...}}<br />
<br />
* {{ic|Alt+6}} to copy a {{ic|Server}} line.<br />
* {{ic|PageUp}} key to scroll up.<br />
* {{ic|Ctrl+U}} to paste it at the top of the list.<br />
* {{ic|Ctrl+X}} to exit, and when prompted to save changes, press {{ic|Y}} and {{ic|Enter}} to use the same filename.<br />
<br />
If you want, you can make it the ''only'' mirror available by getting rid of everything else (using {{ic|Ctrl+K}}), but it is usually a good idea to have a few more, in case the first one goes offline.<br />
<br />
{{Tip|<br />
* Use the [https://www.archlinux.org/mirrorlist/ Mirrorlist Generator] to get an updated list for your country. HTTP mirrors are faster than FTP, because of something called [[Wikipedia:Keepalive|keepalive]]. With FTP, pacman has to send out a signal each time it downloads a package, resulting in a brief pause. For other ways to generate a mirror list, see [[Mirrors#Sorting mirrors|Sorting mirrors]] and [[Reflector]].<br />
* [https://archlinux.org/mirrors/status/ Arch Linux MirrorStatus] reports various aspects about the mirrors such as network problems with mirrors, data collection problems, the last time mirrors have been synced, etc.}}<br />
<br />
{{Note|<br />
* Whenever in the future you change your list of mirrors, always remember to force pacman to refresh all package lists with {{ic|pacman -Syy}}. This is considered to be good practice and will avoid possible headaches. See [[Mirrors]] for more information.<br />
* If you are using an older installation medium, your mirrorlist might be outdated, which might lead to problems when updating Arch Linux (see {{Bug|22510}}). Therefore it is advised to obtain the latest mirror information as described above.<br />
* Some issues have been reported in the [https://bbs.archlinux.org/ Arch Linux forums] regarding network problems that prevent pacman from updating/synchronizing repositories (see [https://bbs.archlinux.org/viewtopic.php?id&#61;68944] and [https://bbs.archlinux.org/viewtopic.php?id&#61;65728]). When installing Arch Linux natively, these issues have been resolved by replacing the default pacman file downloader with an alternative (see [[Improve Pacman Performance]] for more details). When installing Arch Linux as a guest OS in [[VirtualBox]], this issue has also been addressed by using "Host interface" instead of "NAT" in the machine properties.}}<br />
<br />
=== Install the base system ===<br />
<br />
The base system is installed using the ''pacstrap'' script. The {{ic|-i}} switch can be omitted if you wish to install every package from the {{Grp|base}} group without prompting.<br />
<br />
# pacstrap -i /mnt base<br />
<br />
{{Note|<br />
* If pacman fails to verify your packages, stop the process with {{ic|Ctrl+C}} and check the system time with {{ic|cal}}. If the system date is invalid (e.g. it shows the year 2010), signing keys will be considered expired (or invalid), signature checks on packages will fail and installation will be interrupted. Make sure to correct the system time, using the command {{ic|ntpd -qg}}, and retry running the pacstrap command. Refer to [[Time]] page for more information on correcting system time.<br />
* If pacman complains that {{ic|error: failed to commit transaction (invalid or corrupted package)}}, run the following command:<br />
# pacman-key --init && pacman-key --populate archlinux<br />
}}<br />
<br />
This will give you a basic Arch system. Other packages can be installed later using [[pacman]].<br />
<br />
=== Generate an fstab ===<br />
<br />
Generate an [[fstab]] file with the following command. UUIDs will be used because they have certain advantages (see [[fstab#Identifying filesystems]]). If you would prefer to use labels instead, replace the {{ic|-U}} option with {{ic|-L}}.<br />
<br />
# genfstab -U -p /mnt >> /mnt/etc/fstab<br />
# nano /mnt/etc/fstab<br />
<br />
{{Warning|The fstab file should always be checked after generating it. If you encounter errors running genfstab or later in the install process, do '''not''' run genfstab again; just edit the fstab file.}}<br />
<br />
A few considerations:<br />
<br />
* The last field determines the order in which partitions are checked at start up: use {{ic|1}} for the (non-{{ic|btrfs}}) root partition, which should be checked first; {{ic|2}} for all other partitions you want checked at start up; and {{ic|0}} means 'do not check' (see [[fstab#Field definitions]]).<br />
* All [[btrfs]] partitions should have {{ic|0}} for this field. Normally, you will also want your ''swap'' partition to have {{ic|0}}.<br />
<br />
=== Chroot and configure the base system ===<br />
<br />
Next, we [[chroot]] into our newly installed system:<br />
<br />
# arch-chroot /mnt /bin/bash<br />
<br />
{{Note|Leave out {{ic|/bin/bash}} to chroot into the sh shell.}}<br />
At this stage of the installation, you will configure the primary configuration files of your Arch Linux base system. These can either be created if they do not exist, or edited if you wish to change the defaults.<br />
<br />
Closely following and understanding these steps is of key importance to ensure a properly configured system.<br />
<br />
==== Locale ====<br />
<br />
Locales are used by '''glibc''' and other locale-aware programs or libraries for rendering text, correctly displaying regional monetary values, time and date formats, alphabetic idiosyncrasies, and other locale-specific standards.<br />
<br />
There are two files that need editing: {{ic|locale.gen}} and {{ic|locale.conf}}.<br />
<br />
* The {{ic|locale.gen}} file is empty by default (everything is commented out) and you need to remove the {{ic|#}} in front of the line(s) you want. You may uncomment more lines than just English (US), as long as you choose their {{ic|UTF-8}} encoding:<br />
<br />
{{hc|# nano /etc/locale.gen|<br />
en_US.UTF-8 UTF-8<br />
de_DE.UTF-8 UTF-8<br />
}}<br />
<br />
# locale-gen<br />
<br />
This will run on every '''glibc''' upgrade, generating all the locales specified in {{ic|/etc/locale.gen}}.<br />
<br />
* The {{ic|locale.conf}} file does not exist by default. Setting only {{ic|LANG}} should be enough as it will act as the default value for all other variables. Adjust the following commands according to your locale, e.g. {{ic|de_DE.UTF-8}}. Note that the locale specified in the {{ic|LANG}} variable must be uncommented in {{ic|/etc/locale.gen}} as in the previous step.<br />
<br />
# echo LANG=en_US.UTF-8 > /etc/locale.conf<br />
# export LANG=en_US.UTF-8<br />
<br />
To use other locales for other {{ic|LC_*}} variables, run {{ic|locale}} to see the available options and add them to {{ic|locale.conf}}. It is not recommended to set the {{ic|LC_ALL}} variable. See [[Locale#Setting system-wide locale]] for details.<br />
<br />
==== Console font and keymap ====<br />
<br />
If you set a keymap at [[#Change the language|the beginning]] of the install process, load it now, as well, because the environment has changed. For example:<br />
<br />
# loadkeys ''de-latin1''<br />
# setfont Lat2-Terminus16<br />
<br />
To make them available after reboot, edit {{ic|vconsole.conf}} (create it if it does not exist):<br />
<br />
{{hc|# nano /etc/vconsole.conf|2=<br />
KEYMAP=de-latin1<br />
FONT=Lat2-Terminus16<br />
}}<br />
<br />
* {{ic|KEYMAP}} – Please note that this setting is only valid for your TTYs, not any graphical window managers or Xorg.<br />
<br />
* {{ic|FONT}} – Available alternate console fonts reside in {{ic|/usr/share/kbd/consolefonts/}}. The default (blank) is safe, but some foreign characters may show up as white squares or as other symbols. It is recommended that you change it to {{ic|Lat2-Terminus16}}, because according to {{ic|/usr/share/kbd/consolefonts/README.Lat2-Terminus16}}, it claims to support "about 110 language sets".<br />
<br />
* Possible option {{ic|FONT_MAP}} – Defines the console map to load at boot. Read {{ic|man setfont}}. Removing it or leaving it blank is safe.<br />
<br />
See [[Fonts#Console fonts]] and {{ic|man vconsole.conf}} for more information.<br />
<br />
==== Time zone ====<br />
<br />
Available time zones and subzones can be found in the {{ic|/usr/share/zoneinfo/<Zone>/<SubZone>}} directories.<br />
<br />
To view the available <Zone>, check the directory {{ic|/usr/share/zoneinfo/}}:<br />
<br />
# ls /usr/share/zoneinfo/<br />
<br />
Similarly, you can check the contents of directories belonging to a <SubZone>:<br />
<br />
# ls /usr/share/zoneinfo/Europe<br />
<br />
Create a symbolic link {{ic|/etc/localtime}} to your zone file {{ic|/usr/share/zoneinfo/<Zone>/<SubZone>}} using this command:<br />
<br />
# ln -s /usr/share/zoneinfo/<Zone>/<SubZone> /etc/localtime<br />
<br />
'''Example:'''<br />
<br />
# ln -s /usr/share/zoneinfo/Europe/Minsk /etc/localtime<br />
<br />
==== Hardware clock ====<br />
<br />
Set the hardware clock mode uniformly between your operating systems. Otherwise, they may overwrite the hardware clock and cause time shifts.<br />
<br />
You can generate {{ic|/etc/adjtime}} automatically by using one of the following commands:<br />
<br />
* '''UTC''' (recommended)<br />
<br />
: {{Note|Using [[Wikipedia:Coordinated Universal Time|UTC]] for the hardware clock does not mean that software will display time in UTC.}}<br />
<br />
: {{bc|# hwclock --systohc --utc}}<br />
<br />
To synchronize your "UTC" time over the internet, see [[Network Time Protocol daemon|NTPd]].<br />
<br />
* '''localtime''' (discouraged; used by default in Windows)<br />
<br />
: {{Warning|Using ''localtime'' may lead to several known and unfixable bugs. However, there are no plans to drop support for ''localtime''.}}<br />
<br />
: {{bc|# hwclock --systohc --localtime}}<br />
<br />
If you have (or planning on having) a dual boot setup with Windows:<br />
<br />
* Recommended: Set both Arch Linux and Windows to use UTC. A quick [[Time#UTC in Windows|registry fix]] is needed. Also, be sure to prevent Windows from synchronizing the time on-line, because the hardware clock will default back to ''localtime''.<br />
<br />
* Not recommended: Set Arch Linux to ''localtime'' and disable any time-related services, like [[Network Time Protocol daemon|NTPd]] . This will let Windows take care of hardware clock corrections and you will need to remember to boot into Windows at least two times a year (in Spring and Autumn) when [[Wikipedia:Daylight saving time|DST]] kicks in. So please do not ask on the forums why the clock is one hour behind or ahead if you usually go for days or weeks without booting into Windows.<br />
<br />
==== Kernel modules ====<br />
<br />
{{Tip|This is just an example, you do not need to set it. All needed modules are automatically loaded by udev, so you will rarely need to add something here. Only add modules that you know are missing.}}<br />
<br />
For kernel modules to load during boot, place a {{ic|*.conf}} file in {{ic|/etc/modules-load.d/}}, with a name based on the program that uses them.<br />
<br />
{{hc|# nano /etc/modules-load.d/virtio-net.conf|<br />
# Load 'virtio-net.ko' at boot.<br />
<br />
virtio-net}}<br />
<br />
If there are more modules to load per {{ic|*.conf}}, the module names can be separated by newlines. A good example are the [[VirtualBox#Arch Linux guests|VirtualBox Guest Additions]].<br />
<br />
Empty lines and lines starting with {{ic|#}} or {{ic|;}} are ignored.<br />
<br />
==== Hostname ====<br />
<br />
Set the [[Wikipedia:hostname|hostname]] to your liking (e.g. ''arch''):<br />
<br />
# echo ''myhostname'' > /etc/hostname<br />
<br />
{{Note|There is no need to edit {{ic|/etc/hosts}}.}}<br />
<br />
=== Configure the network ===<br />
<br />
You need to configure the network again, but this time for your newly installed environment. The procedure and prerequisites are very similar to the one described [[#Establish an internet connection|above]], except we are going to make it persistent and automatically run at boot.<br />
<br />
{{Note|<br />
* For more in-depth information on network configration, visit [[Network Configuration]] and [[Wireless Setup]].<br />
* If you would like to use the old interface naming scheme (ie. eth* and wlan*) you can accomplish this by creating an empty file at {{ic|/etc/udev/rules.d/80-net-name-slot.rules}} which will mask the file of the same name located under {{ic|/usr/lib/udev/rules.d}}.<br />
}}<br />
<br />
==== Wired ====<br />
<br />
===== Dynamic IP =====<br />
<br />
; Using dhcpcd<br />
<br />
If you only use a single fixed wired network connection, you do not need a network management service and can simply enable the {{ic|dhcpcd}} service:<br />
<br />
# systemctl enable dhcpcd.service<br />
<br />
{{Note|If it doesn't work, use: {{ic|# systemctl enable dhcpcd@''interface_name''.service}} }}<br />
<br />
; Using netctl<br />
<br />
Copy a sample profile from {{ic|/etc/netctl/examples}} to {{ic|/etc/netctl}}:<br />
<br />
# cd /etc/netctl<br />
# cp examples/ethernet-dhcp my_network<br />
<br />
Edit the profile as needed (update {{ic|Interface}} from {{ic|eth0}} to match network adapter ID as shown by running {{ic|ip link}}):<br />
<br />
# nano my_network<br />
<br />
Enable the {{ic|my_network}} profile:<br />
<br />
# netctl enable my_network<br />
<br />
{{Note|You will get the message "Running in chroot, ignoring request.". This can be ignored for now.}}<br />
<br />
; Using netctl-ifplugd<br />
<br />
{{Warning|You cannot use this method in conjunction with explicitly enabling profiles, such as {{ic|netctl enable <profile>}}.}}<br />
<br />
Alternatively, you can use {{ic|netctl-ifplugd}}, which gracefully handles dynamic connections to new networks:<br />
<br />
Install {{Pkg|ifplugd}}, which is required for {{ic|netctl-ifplugd}}:<br />
<br />
# pacman -S ifplugd<br />
<br />
Then enable for interface that you want:<br />
<br />
# systemctl enable netctl-ifplugd@<interface>.service<br />
<br />
{{Tip|[[Netctl]] also provides {{ic|netctl-auto}}, which can be used to handle wired profiles in conjunction with {{ic|netctl-ifplugd}}.}}<br />
<br />
===== Static IP =====<br />
<br />
; Using netctl<br />
<br />
Copy a sample profile from {{ic|/etc/netctl/examples}} to {{ic|/etc/netctl}}:<br />
<br />
# cd /etc/netctl<br />
# cp examples/ethernet-static my_network<br />
<br />
Edit the profile as needed (modify {{ic|Interface}}, {{ic|Address}}, {{ic|Gateway}} and {{ic|DNS}}):<br />
<br />
# nano my_network<br />
<br />
* Notice the {{ic|/24}} in {{ic|Address}} which is the [[wikipedia:Classless Inter-Domain Routing#CIDR notation|CIDR notation]] of a {{ic|255.255.255.0}} netmask<br />
<br />
Enable above created profile to start it at every boot:<br />
<br />
# netctl enable my_network<br />
<br />
==== Wireless ====<br />
<br />
{{Note|If your wireless adapter requires a firmware (as described in the above [[#Wireless|Establish an internet connection]] section and also [[Wireless Setup#Device driver|here]]), install the package containing your firmware. Most of the time, the {{Pkg|linux-firmware}} package will contain the needed firmware. Though for some devices, the required firmware might be in its own package. For example:<br />
{{bc|# pacman -S zd1211-firmware}}<br />
See [[Wireless Setup#Installing driver/firmware]] for more info.}}<br />
<br />
Install {{Pkg|iw}} and {{Pkg|wpa_supplicant}} which you will need to connect to a network:<br />
<br />
# pacman -S iw wpa_supplicant<br />
<br />
===== Adding wireless networks =====<br />
<br />
; Using wifi-menu<br />
<br />
Install {{Pkg|dialog}}, which is required for {{ic|wifi-menu}}:<br />
<br />
# pacman -S dialog<br />
<br />
After finishing the rest of this installation and rebooting, you can connect to the network with {{ic|wifi-menu ''interface_name''}} (where {{ic|''interface_name''}} is the interface of your wireless chipset).<br />
<br />
# wifi-menu ''interface_name''<br />
<br />
{{Warning|This must be done *after* your reboot when you are no longer chrooted. The process spawned by this command will conflict with the one you have running outside of the chroot. Alternatively, you could just configure a network profile manually using the following templates so that you do not have to worry about using {{ic|wifi-menu}} at all.}}<br />
<br />
; Using manual netctl profiles<br />
<br />
Copy a network profile from {{ic|/etc/netctl/examples}} to {{ic|/etc/netctl}}:<br />
<br />
# cd /etc/netctl<br />
# cp examples/wireless-wpa my-network<br />
<br />
Edit the profile as needed (modify {{ic|Interface}}, {{ic|ESSID}} and {{ic|Key}}):<br />
<br />
# nano my-network<br />
<br />
Enable above created profile to start it at every boot:<br />
<br />
# netctl enable my-network<br />
<br />
===== Connect automatically to known networks =====<br />
<br />
{{Warning|You cannot use this method in conjunction with explicitly enabling profiles, such as {{ic|netctl enable <profile>}}.}}<br />
<br />
Install {{Pkg|wpa_actiond}}, which is required for {{ic|netctl-auto}}:<br />
<br />
# pacman -S wpa_actiond<br />
<br />
Enable the {{ic|netctl-auto}} service, which will connect to known networks and gracefully handle roaming and disconnects:<br />
<br />
# systemctl enable netctl-auto@''interface_name''.service<br />
<br />
{{Tip|[[Netctl]] also provides {{ic|netctl-ifplugd}}, which can be used to handle wired profiles in conjunction with {{ic|netctl-auto}}.}}<br />
<br />
==== Analog modem, ISDN or PPPoE DSL ====<br />
<br />
For xDSL, dial-up and ISDN connections, see [[Direct Modem Connection]].<br />
<br />
=== Create an initial ramdisk environment ===<br />
<br />
{{Tip|Most users can skip this step and use the defaults provided in {{ic|mkinitcpio.conf}}. The initramfs image (from the {{ic|/boot}} folder) has already been generated based on this file when the {{Pkg|linux}} package (the Linux kernel) was installed earlier with {{ic|pacstrap}}.}}<br />
<br />
Here you need to set the right [[Mkinitcpio#HOOKS|hooks]] if the root is on a USB drive, if you use RAID, LVM, or if {{ic|/usr}} is on a separate partition.<br />
<br />
Edit {{ic|/etc/mkinitcpio.conf}} as needed and re-generate the initramfs image with:<br />
<br />
# mkinitcpio -p linux<br />
<br />
{{Note|Arch VPS installations on QEMU (e.g. when using {{ic|virt-manager}}) may need {{ic|virtio}} modules in {{ic|mkinitcpio.conf}} to be able to boot.<br />
<br />
{{hc|# nano /etc/mkinitcpio.conf|2=<br />
MODULES="virtio virtio_blk virtio_pci virtio_net"<br />
}}<br />
}}<br />
<br />
=== Set the root password ===<br />
<br />
Set the root password with:<br />
<br />
# passwd<br />
<br />
=== Install and configure a bootloader ===<br />
<br />
==== For BIOS motherboards ====<br />
<br />
For BIOS systems, several boot loaders are available, see [[Boot Loaders]] for a complete list. Choose one as per your convenience. Here, we give two of the possibilities as examples:<br />
<br />
* Syslinux is (currently) limited to loading only files from the partition where it was installed. Its configuration file is considered to be easier to understand. An example configuration can be found [https://bbs.archlinux.org/viewtopic.php?pid=1109328#p1109328 here].<br />
<br />
* GRUB is more feature-rich and supports more complex scenarios. Its configuration file(s) is more similar to 'sh' scripting language, which may be difficult for beginners to manually write. It is recommended that they automatically generate one.<br />
<br />
===== Syslinux =====<br />
<br />
If you opted for a GUID partition table (GPT) for your hard drive earlier, you need to install the {{Pkg|gptfdisk}} package now for the installation of syslinux to work.<br />
<br />
# pacman -S gptfdisk<br />
<br />
Install the {{Pkg|syslinux}} package and then use the {{ic|syslinux-install_update}} script to automatically ''install'' the bootloader ({{ic|-i}}), mark the partition ''active'' by setting the boot flag ({{ic|-a}}), and install the ''MBR'' boot code ({{ic|-m}}):<br />
<br />
# pacman -S syslinux<br />
# syslinux-install_update -i -a -m<br />
<br />
Configure {{ic|syslinux.cfg}} to point to the right root partition. This step is vital. If it points to the wrong partition, Arch Linux will not boot. Change {{ic|/dev/sda3}} to reflect your root partition ''(if you partitioned your drive as in [[#Prepare the storage drive|the example]], your root partition is {{ic|/dev/sda1}})''. Do the same for the fallback entry.<br />
<br />
{{hc|# nano /boot/syslinux/syslinux.cfg|2=<br />
...<br />
LABEL arch<br />
...<br />
APPEND root='''/dev/sda3''' rw<br />
...}}<br />
<br />
For more information on configuring and using Syslinux, see [[Syslinux]].<br />
<br />
===== GRUB =====<br />
<br />
Install the {{Pkg|grub}} package and then run {{ic|grub-install}} to install the bootloader:<br />
<br />
# pacman -S grub<br />
# grub-install --target=i386-pc --recheck '''/dev/sda'''<br />
<br />
{{Note|<br />
* Change {{ic|/dev/sda}} to reflect the drive you installed Arch on. Do not append a partition number (do not use {{ic|sda''X''}}).<br />
* For GPT-partitioned drives on BIOS motherboards, you also need a "BIOS Boot Partition". See [[GRUB#GUID Partition Table (GPT) specific instructions|GPT-specific instructions]] in the GRUB page.<br />
}}<br />
<br />
While using a manually created {{ic|grub.cfg}} is absolutely fine, it is recommended that beginners automatically generate one:<br />
<br />
{{Tip|To automatically search for other operating systems on your computer, install {{Pkg|os-prober}} ({{ic|pacman -S os-prober}}) before running the next command.}}<br />
<br />
# grub-mkconfig -o /boot/grub/grub.cfg<br />
<br />
For more information on configuring and using GRUB, see [[GRUB]].<br />
<br />
==== For UEFI motherboards ====<br />
<br />
For UEFI systems, several boot loaders are available, see [[Boot Loaders]] for a complete list. Choose one as per your convenience. Here, we give two of the possibilities as examples:<br />
<br />
* [[gummiboot]] is a minimal UEFI Boot Manager which basically provides a menu for [[EFISTUB]] kernels and other UEFI applications. This is recommended UEFI boot method. <br />
* GRUB is a more complete bootloader, useful if you run into problems with Gummiboot.<br />
<br />
{{Note|For UEFI boot, the drive needs to be GPT-partitioned and an [[Unified Extensible Firmware Interface#EFI System Partition|EFI System Partition]] (512 MiB or larger, gdisk type {{ic|EF00}}, formatted with FAT32) must be present. In the following examples, this partition is assumed to be mounted at {{ic|/boot}}. If you have followed this guide from the beginning, you have already done all of these.}}<br />
<br />
===== Gummiboot =====<br />
<br />
First install the {{Pkg|gummiboot}} package and then run {{ic|gummiboot install}} to install the bootloader to the EFI System Partition:<br />
<br />
# mount -t efivarfs efivarfs /sys/firmware/efi/efivars # ignore if already mounted<br />
# pacman -S gummiboot<br />
# gummiboot install<br />
<br />
You will need to manually create a configuration file to add an entry for Arch Linux to the gummiboot manager. Create {{ic|/boot/loader/entries/arch.conf}} and add the following contents, replacing {{ic|/dev/sdaX}} with your root partition, usually {{ic|/dev/sda2}}:<br />
<br />
{{hc|# nano /boot/loader/entries/arch.conf|2=<br />
title Arch Linux<br />
linux /vmlinuz-linux<br />
initrd /initramfs-linux.img<br />
options root='''/dev/sdaX''' rw<br />
}}<br />
<br />
For more information on configuring and using gummiboot, see [[gummiboot]].<br />
<br />
===== GRUB =====<br />
<br />
Install the {{Pkg|grub}} and {{Pkg|efibootmgr}} packages and then run {{ic|grub-install}} to install the bootloader:<br />
<br />
# mount -t efivarfs efivarfs /sys/firmware/efi/efivars # ignore if already mounted<br />
# pacman -S grub efibootmgr<br />
# grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=arch_grub --recheck<br />
<br />
Next, while using a manually created {{ic|grub.cfg}} is absolutely fine, it is recommended that beginners automatically generate one:<br />
<br />
{{Tip|To automatically search for other operating systems on your computer, install {{Pkg|os-prober}} before running the next command. However os-prober is not known to properly detect UEFI OSes.}}<br />
<br />
# grub-mkconfig -o /boot/grub/grub.cfg<br />
<br />
For more information on configuring and using GRUB, see [[GRUB]].<br />
<br />
=== Unmount the partitions and reboot ===<br />
<br />
Exit from the chroot environment:<br />
<br />
# exit<br />
<br />
Since the partitions are mounted under {{ic|/mnt}}, we use the following command to unmount them:<br />
<br />
# umount -R /mnt<br />
<br />
Reboot the computer:<br />
<br />
# reboot<br />
<br />
{{Tip|Be sure to remove the installation media, otherwise you will boot back into it.}}<br />
<noinclude>{{Beginners' Guide navigation}}</noinclude></div>Intrixius