# Building Chrome
The following steps mostly all come from https://chromium.googlesource.com/chromium/src/+/master/docs/linux/build_instructions.md
Tested on Ubuntu Server 20.4
0. Enable a large swapfile (If you have < 32GB of system memory)
Chromium uses a lot of memory to build. Here, we create a swapfile of 16GB and mounts it.
```bash
sudo fallocate -l 16G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
```
To make the changes permanent add the following line to `/etc/fstab`
```bash
/swapfile swap swap defaults 0 0
```
1. Some initial dependencies
```bash
sudo apt install python python-pip git
pip install setuptools
```
2. Install `depot_tools`, the git tools google wrote for chromium
```bash
cd
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
export PATH="$PATH:${HOME}/depot_tools"
```
(You can also put the depot_tools directory in a place that's not your home directory, but you have to change the export command accordingly)
3. Get the code
```bash
mkdir ~/chromium && cd ~/chromium
fetch --nohooks chromium
```
4. More Dependencies
```bash
cd src
./build/install-build-deps.sh
sudo apt install python-pip
pip install setuptools
gclient runhooks
```
5. Generate build config
```bash=
mkdir out/Default
echo 'enable_nacl=false' > out/Default/args.gn
gn gen out/Default
```
6. Build!
```bash
autoninja -C out/Default chrome
```
When that finishes, output is saved to `out/Default/chrome`