# Packaged FarmOS Install on Ubuntu

**URL:** https://farmos.discourse.group/t/packaged-farmos-install-on-ubuntu/2079
**Category:** Hosting farmOS
**Created:** [July 16, 2024, 5:05pm UTC](https://farmos.discourse.group/t/packaged-farmos-install-on-ubuntu/2079 "2024-07-16T17:05:49Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![lmcmullen](https://avatars.discourse-cdn.com/v4/letter/l/c57346/32.png) [@lmcmullen](https://farmos.discourse.group/u/lmcmullen)
#### Post date: [July 16, 2024, 5:05pm UTC](https://farmos.discourse.group/t/packaged-farmos-install-on-ubuntu/2079/1 "2024-07-16T17:05:49Z")

</div>

– The following instructions provide steps to setup FarmOS 3.2.2 on a fresh/default AMI install of Ubuntu 24.04 in AWS

1. Log in to your instance and run updates and upgrades

> sudo apt update -y  
> sudo apt upgrade -y

1. Install dependent applications

> sudo apt install apache2 mysql-server php php-cli php-mysql php-gd php-curl php-xml php-mbstring libapache2-mod-php unzip -y

– These can probably be included in the command above. If not, you can run them any time to resolve the warnings found in FarmOS Status Report

> sudo apt install php-bcmath -y  
> sudo apt install php-geos -y

1. Deploy FarmOS web app

> cd /var/www/html  
> sudo wget [https://github.com/farmOS/farmOS/releases/download/3.2.2/farmOS-3.2.2.tar.gz](https://github.com/farmOS/farmOS/releases/download/3.2.2/farmOS-3.2.2.tar.gz)  
> sudo gunzip farmOS-3.2.2.tar.gz  
> sudo tar -xvf farmOS-3.2.2.tar  
> sudo rm farmOS-3.2.2.tar

– Let’s be consistent with the use of letter case; Set owner and permissions

> sudo mv farmOS farmos  
> sudo chown -R www-data:www-data farmos  
> sudo chmod -R 755 farmos

1. Setup the web config file

> sudo nano /etc/apache2/sites-available/farmos.conf

– add stuff in block below replacing anything between {} with values specific to you

## 

```auto
 <VirtualHost *:80>
     ServerAdmin {your email address}
     DocumentRoot /var/www/html/farmos/web
     ServerName {your server name}
     <Directory /var/www/html/farmos/web>
         Options Indexes FollowSymLinks
         AllowOverride All
         Require all granted
     </Directory>
     ErrorLog ${APACHE_LOG_DIR}/farmos_error.log
     CustomLog ${APACHE_LOG_DIR}/farmos_access.log combined
  </VirtualHost>

```

1. Add rewrite mod; Enable FarmOS site and disable the default Apache2 site

> sudo a2ensite farmos.conf  
> sudo a2dissite 000-default.conf  
> sudo a2enmod rewrite  
> sudo systemctl restart apache2

1. Setup the Database and secure it; Replace {your password} with the value you want

> sudo mysql -u root -p

– no password for root yet so hit enter

```auto
ALTER USER 'root'@'localhost' IDENTIFIED BY '{your password}';

CREATE DATABASE farmos;
CREATE USER 'farmos_user'@'localhost' IDENTIFIED BY '{your password}';
GRANT ALL PRIVILEGES ON farmos.* TO 'farmos_user'@'localhost';
FLUSH PRIVILEGES;
EXIT;

```

– You may choose to further secure the MySQL instance with the following wizard

> sudo mysql\_secure\_installation

1. Use a browser to finish setting up and configuring your installation  
For instance, if your server name is [foo.bar.com](http://foo.bar.com), go to [http://foo.bar.com](http://foo.bar.com)  
Follow the prompts to finish your install

2. Additional follow up after FarmOS running.  
Go to Administration → Reports → Status report

You will see some or all of the errors/warnings below:

**Errors**

- Transaction isolation level:  
The following table(s) do not have a primary key: data\_stream\_basic.  
/fix to be added/

**Warnings**

- File system: Writable (private download method)
- Trusted Host Settings: Not enabled

To fix the two above, create a backup copy of and edit the following file

> /var/www/html/farmos/web/sites/default/settings.php

Uncomment and modify the line as shown below (search for file\_private\_path)

> $settings[‘file\_private\_path’] = ‘/var/www/html/farmos/web/private:’;

Also uncomment and edit the line below (search for trusted\_host\_patterns)

> $settings[‘trusted\_host\_patterns’] = [‘^foo.bar.com$’];

Once settings.php is modified, run the following

> sudo /var/www/html/farmOS/vendor/bin/drush cr  
> sudo systemctl restart apache2

- Drupal core security coverage  
/fix to be added/
- Drupal core update status  
/fix to be added/
- Module and theme update status  
/fix to be added/
