1 # Manual Installation Guide
3 These instructions are based on Ubuntu 24.04 LTS, though the OSMF servers are currently running Debian 12. The instructions also work, with only minor amendments, for all other current Ubuntu releases, Fedora and macOS.
7 Many of the dependencies are managed through the standard Ruby on Rails mechanisms - i.e. Ruby gems specified in the Gemfile and installed using Bundler. Some system packages are also required before you can get the various gems installed.
9 **Minimum requirements:**
12 * Bundler (see note below about [developer Ruby setup](#ruby-version-manager-optional))
15 ## Step 1: Install System Dependencies
21 sudo apt-get install ruby ruby-dev ruby-bundler \
22 libvips-dev libxml2-dev libxslt1-dev \
23 nodejs build-essential git-core \
24 postgresql postgresql-contrib libpq-dev \
25 libsasl2-dev libffi-dev libgd-dev \
26 libarchive-dev libyaml-dev libbz2-dev npm
27 sudo npm install --global yarn
31 > On Ubuntu 24.04, you may need to start PostgreSQL:
34 > sudo systemctl start postgresql.service
40 sudo dnf install ruby ruby-devel rubygem-rdoc rubygem-bundler \
41 rubygems libxml2-devel nodejs gcc gcc-c++ git \
42 postgresql postgresql-server \
43 postgresql-contrib libpq-devel \
44 perl-podlators libffi-devel gd-devel \
45 libarchive-devel libyaml-devel bzip2-devel \
46 nodejs-yarn vips-devel
49 On Fedora, if you didn't already have PostgreSQL installed then create a PostgreSQL instance and start the server:
52 sudo postgresql-setup initdb
53 sudo systemctl start postgresql.service
56 Optionally set PostgreSQL to start on boot:
59 sudo systemctl enable postgresql.service
64 For macOS, you will need [Xcode Command Line Tools](https://mac.install.guide/commandlinetools/); macOS 14 (Sonoma) or later; and some familiarity with Unix development via the Terminal.
66 **Installing PostgreSQL:**
68 * Install Postgres.app from https://postgresapp.com/
69 * Make sure that you've initialized and started Postgresql from the app (there should be a little elephant icon in your systray).
70 * Add PostgreSQL to your path, by editing your profile:
79 export PATH=/Applications/Postgres.app/Contents/Versions/latest/bin:$PATH
82 After this, you may need to start a new shell window, or source the profile again by running `. ~/.profile`.
84 **Installing other dependencies:**
86 * Install Homebrew from https://brew.sh/
87 * Install system dependencies, including Ruby:
89 brew install ruby libxml2 gd yarn pngcrush optipng \
90 pngquant jhead jpegoptim gifsicle svgo \
93 * Install Bundler: `gem install bundler` (you might need to `sudo gem install bundler` if you get an error about permissions - or see note below about [developer Ruby setup](#ruby-version-manager-optional))
95 You will need to tell `bundler` that `libxml2` is installed in a Homebrew location. If it uses the system-installed one then you will get errors installing the `libxml-ruby` gem later on.
98 bundle config build.libxml-ruby --with-xml2-config=/usr/local/opt/libxml2/bin/xml2-config
101 If you want to run the tests, you need `geckodriver` as well:
104 brew install geckodriver
108 > OS X does not have a /home directory by default, so if you are using the GPX functions, you will need to change the directories specified in config/application.yml.
110 ## Step 2: Clone the Repository
112 The repository is reasonably large (~560MB) and it's unlikely that you'll need the full history. Therefore you can probably do with a shallow clone (~100MB):
114 git clone --depth=1 https://github.com/openstreetmap/openstreetmap-website.git
117 If you want to add in the full history later on, perhaps to run `git blame` or `git log`, run `git fetch --unshallow`.
120 > To download the full history from the start, run:
122 > git clone https://github.com/openstreetmap/openstreetmap-website.git
125 ## Step 3: Install Application Dependencies
129 We use [Bundler](https://bundler.io/) to manage the rubygems required for the project.
132 cd openstreetmap-website
138 We use [Yarn](https://yarnpkg.com/) to manage the Node.js modules required for the project.
141 bundle exec bin/yarn install
144 ## Step 4: Prepare Configuration Files
146 ### Local settings file
149 > This is a workaround. [See issues/2185 for details](https://github.com/openstreetmap/openstreetmap-website/issues/2185#issuecomment-508676026).
152 touch config/settings.local.yml
157 `openstreetmap-website` needs to be configured with an object storage facility - for development and testing purposes you can use the example configuration:
160 cp config/example.storage.yml config/storage.yml
163 ## Step 5: Database Setup
165 `openstreetmap-website` uses three databases - one for development, one for testing, and one for production. The database-specific configuration options are stored in `config/database.yml`, which we need to create from the example template.
168 cp config/example.database.yml config/database.yml
172 > PostgreSQL is configured to, by default, accept local connections without requiring a username or password. This is fine for development. If you wish to set up your database differently, then you should change the values found in the `config/database.yml` file, and amend the instructions below as appropriate.
174 ### PostgreSQL account setup
176 We need to create a PostgreSQL role (i.e. user account) for your current user, and it needs to be a superuser so that we can create more databases.
180 createuser -s <username>
184 ### Create the databases
186 To create the three databases - for development, testing and production - run:
189 bundle exec rails db:create
192 ### Database structure
194 To create all the tables, indexes and constraints, run:
197 bundle exec rails db:migrate
200 ## Validate Your Installation
202 ### Running the tests
204 To ensure that everything is set up properly, you should now run:
207 bundle exec rails test:all
210 This test will take a few minutes, reporting tests run, assertions, and any errors. If you receive no errors, then your installation is successful.
213 > The unit tests may output parser errors related to "Attribute lat redefined." These can be ignored.
215 ### Starting the server
217 Rails comes with a built-in webserver, so that you can test on your own machine without needing a server. Run
220 bundle exec rails server
223 You can now view the site in your favourite web-browser at [http://localhost:3000/](http://localhost:3000/)
226 > The OSM map tiles you see aren't created from your local database - they are the production map tiles, served from a separate service over the Internet.
230 🎉 **Congratulations!** You have successfully installed the OpenStreetMap website.
233 * **Configuration:** See [CONFIGURE.md](CONFIGURE.md) for populating the database with data, creating users, setting up OAuth, and other configuration tasks.
234 * **Contributing:** Check out [CONTRIBUTING.md](../CONTRIBUTING.md) for coding style guidelines, testing procedures, and how to submit your contributions.
236 ## Ruby Version Manager (Optional)
238 For simplicity, this document explains how to install all the website dependencies as "system" dependencies. While this can be simpler and faster, you might want more control over the process or the ability to install multiple different versions of Ruby alongside each other.
240 Several tools exist that allow managing multiple different Ruby versions on the same computer. They also provide the additional advantage that the installs are all in your home directory, so you don't need administrator permissions. These tools are typically known as "version managers".
242 This section shows how to install Ruby and Bundler with [`rbenv`](https://github.com/rbenv/rbenv), which is one of these tools. If you choose to install Ruby and Bundler via `rbenv`, then you do not need to install the system libraries for Ruby:
244 * For Ubuntu, you do not need to install the following packages: `ruby ruby-dev ruby-bundler`,
245 * For Fedora, you do not need to install the following packages: `ruby ruby-devel rubygem-rdoc rubygem-bundler rubygems`
246 * For macOS, you do not need to `brew install ruby`
249 > On macOS, make sure you've installed a version of Ruby using `rbenv` before running `gem install bundler`!
251 After installing a version of Ruby with `rbenv` (the latest stable version is a good place to start), you will need to make that the default. From inside the `openstreetmap-website` directory, run:
257 Where `$VERSION` is the version you installed. You can see a list of available versions by running `rbenv versions`. Then install bundler:
263 You should now be able to proceed with the rest of the installation. If you're on macOS, make sure you set up the [config override for the libxml2 location](#macos-click-to-expand) _after_ installing bundler.