Installing Dolt as an application server
These instructions are for bootstrapping dolt as an application database server. They assume you are starting from scratch on a Linux machine without dolt installed or running.
Package manager support (.deb and .rpm distributions) is coming soon, but for now this set of manual setup work is necessary.
We have the instructions below packaged in a script here.

Installation

Install dolt. Run the following command:
1
sudo bash -c 'curl -L https://github.com/dolthub/dolt/releases/latest/download/install.sh | sudo bash'
Copied!
This script puts the dolt binary in /usr/local/bin, which is probably on your $PATH. If it isn't add it there or use use the absolute path of the dolt binary for next steps.

Configuration

Create a system account for the dolt user to run the server.
1
sudo useradd -r -m -d /var/lib/doltdb dolt
Copied!
Before running the server, you need to give this user a name and email, which it will use to create its commits. Choose a dolt system account for your product or company.
1
$ cd /var/lib/doltdb
2
$ sudo -u dolt dolt config --global --add user.email [email protected]
3
$ sudo -u dolt dolt config --global --add user.name "Dolt Server Account"
Copied!
You can override this user for future commits with the --author flag, but this will be default author of every commit in the server.

Database creation

Before running the dolt server for the first time, you need to create a database. Choose a directory within /var/lib/doltdb/databases where you want your dolt data to live. Name the directory the same as the name of your database.
1
cd /var/lib/doltdb
2
sudo -u dolt mkdir -p databases/my_db
3
cd databases/my_db
4
sudo -u dolt dolt init
Copied!
You should see output indicating that the database has been initialized:
1
Successfully initialized dolt data repository.
Copied!

Start the server

Assuming you want your dolt server to always be running when the machine is alive, you should configure it to run through the Linux service management tool, systemctl. Some distributions of Linux do not support this tool; consult their documentation for configuration instructions.
Write the server's config file in your home directory, then move it to where systemctl needs it to live.
1
cd ~
2
cat > doltdb.service <<EOF
3
[Unit]
4
Description=dolt SQL server
5
After=network.target
6
7
[Install]
8
WantedBy=multi-user.target
9
10
[Service]
11
User=dolt
12
Group=dolt
13
ExecStart=/usr/local/bin/dolt sql-server -u root
14
WorkingDirectory=/var/lib/doltdb/databases/my_db
15
KillSignal=SIGTERM
16
SendSIGKILL=no
17
EOF
18
19
sudo chown root:root doltdb.service
20
sudo chmod 644 doltdb.service
21
sudo mv doltdb.service /etc/systemd/system
Copied!
Finally, start the server as a system daemon.
1
sudo systemctl daemon-reload
2
sudo systemctl enable doltdb.service
3
sudo systemctl start doltdb
Copied!
The dolt sql server will now be running as a daemon. Test connecting to it with any SQL shell. Here we are using the mysql shell to connect.
1
mysql -h 127.0.0.1 -u root -p''
Copied!
Note that by default, Dolt runs on the same port as MySQL (3306). If you have MySQL installed on the same host, choose a different port for the server with the -P argument.

Users and passwords

With the above settings, dolt runs with a single user root and an empty password. Dolt currently supports a single user and password. To change the name and password of the SQL user, provide a config file as described in the sql-server docs.
Other configuration such as logging behavior, timeouts, etc. are available via this method as well.

Other Linux distributions

These instructions should work for Debian, Ubuntu, Amazon Linux, and many other common distributions. If you find they don't work for yours and you would like your distribution documented, come chat with us on Discord or submit a PR to update the docs.
Last modified 23d ago