**Learn how to install DOSBox in Ubuntu and configure it to play old DOS games.**
DOSBox is a free and open-source operating system emulator that can run inside modern Linux systems. It has several components which emulate older hardware so that ancient programs and games can run.
All these make it possible to enjoy the older games and applications in modern Linux distributions.
In this guide, I will show you how to install DOSBox, configure it and play a sample game.
### Install DOSBox in Ubuntu
The main package of DOSBox is available in all the major repo of Linux distributions.
For Ubuntu, Debian, Linux Mint and related distributions use the following command to install it:
```
sudo apt install dosbox
```
For Fedora, CentOS, RHEL and related distributions use the following:
```
sudo dnf install dosbox
```
Arch Linux users, use the following command to install it.
```
pacman -S --needed dosbox
```
That will conclude the installation. Now it’s time to configure and run.
### Running DOSBox
After installation, type the following from the terminal.
```
dosbox
```
It will show you the following screen showing the DOSBox prompt. This first-time run is essential because it creates the DOSBox configuration file.
Type `exit` to close DOSBox for now.
![DOSBox first time run][1]
The configuration file gives you several options to tweak settings. The file is created at your home directory path `~/.dosbox/dosbox-[version].conf` for Ubuntu.
For fedora, it loads the staging config file from this path`~/.config/dosbox/dosbox-staging.conf`.
By default, you can keep the configuration unchanged. However, if you want, you can change it.
For example, if you want to start DOSBox fullscreen, you can enable and disable the switch. Here’s a sample:
```
fullscreen=false
fulldouble=false
fullresolution=original
windowresolution=original
output=surface
autolock=true
sensitivity=100
waitonerror=true
```
You can find all the settings in the official [documentation][2].
### Download old games and run
There are many websites which provide old DOS games. I have used the following website, which provides a fair set of old games which can be played in the modern system.
So, visit the following page and download any game you want.
[Download DOS games][3]
Create a directory in your /home folder and name it dosbox.
```
cd ~mkdir dosbox
```
Now, extract the game which you downloaded (it should be a .exe file) and create a separate folder inside `~/dosbox`.
For example, I downloaded the game “Mario & Luigi (1994)”. And I created a folder called “mario” inside the “dosbox” folder. And placed the game file inside it.
![Keep the game in a separate folder][4]
Now launch dosbox from the terminal.
```
dosbox
```
And type the following to mount the game in a virtual C: drive.
```
mount c ~/dosbox/mario
```
After the above command is complete, change the drive to C:.
```
c:
```
And now, you can type the game’s file name to run the game.
```
mario
```
![Running the game][5]
![Mario running in DOSBox in Ubuntu][6]
### Keyboard or controller mapping
By default, DOSBox should detect the keyboard or any controller you may have plugged in. However, if you want to change game keybindings, you can run the below command from the terminal.
```
dosbox -startmapper
```
It will give you the following screen with the events tagged to each key. You can click on any key and change it according to your taste.
![DOSBox keyboard and controller mapping][7]
### Conclusion
I hope you managed to run your favourite dos game after installing dosbox in Ubuntu and other distros. DOSBox is one of the coolest pieces of software you can use to run any program, such as [Turbo C][8] and others.
If you have any trouble or questions, let me know in the comment box.