Skip to content

Digital Ocean Setup

Ryan Haudenschilt edited this page Mar 25, 2024 · 27 revisions
  1. Create a new droplet

  2. SSH into new droplet as root ?

  3. Create a new user with superuser

    1. adduser XXX
    2. usermod -aG sudo XXX
  4. Configure firewall

    1. ufw allow OpenSSH
    2. ufw enable
  5. SSH into droplet as XXX user

  6. OPTIONAL - If droplet has less than 1GB ram, add swap space.

    1. sudo fallocate -l 1G /swapfile
    2. sudo chmod 600 /swapfile
    3. sudo mkswap /swapfile
    4. sudo cp /etc/fstab /etc/fstab.bak
    5. echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab
  7. Install the LAMP or LEMP stack ?

    1. sudo apt update
    2. sudo apt install apache2
    3. sudo ufw allow in "Apache Full"
    4. sudo apt install mysql-server
    5. sudo mysql
    6. ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password by '<ROOT_DB_PASSWORD>';
    7. exit
    8. sudo mysql_secure_installation
    9. sudo apt install php libapache2-mod-php php-mysql
  8. Configure apache vhosts

    1. sudo mkdir /var/www/fcms
    2. sudo chown -R $USER:$USER /var/www/fcms
    3. sudo vi /etc/apache2/sites-available/fcms.conf
    <VirtualHost *:80>
        ServerName <YOUR_DOMAIN>
        ServerAlias <YOUR_DOMAIN>
        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/fcms/public
    
        <Directory /var/www/fcms/public>
            Options +FollowSymlinks
            AllowOverride All
            Require all granted
        </Directory>
    
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
    </VirtualHost>
    
    1. sudo a2ensite fcms
    2. sudo a2dissite 000-default
    3. sudo a2enmod rewrite
    4. sudo systemctl reload apache2
  9. Configure php.ini

    1. sudo vi /etc/php/8.1/apache2/php.ini
    2. upload_max_filesize = 64M
    3. post_max_size = 64M
  10. Add rest of things laravel needs

    1. sudo apt update
    2. sudo apt install php-mbstring php-xml php-bcmath php-curl php-imagick
    3. sudo apt install php-cli unzip ?
    4. cd ~
    5. curl -sS https://getcomposer.org/installer -o /tmp/composer-setup.php
    6. sudo php /tmp/composer-setup.php --install-dir=/usr/local/bin --filename=composer
    7. cd ~
    8. curl -sL https://deb.nodesource.com/setup_18.x -o nodesource_setup.sh ?
    9. sudo bash nodesource_setup.sh
    10. sudo apt install nodejs
  11. Setup the laravel project

    1. cd /var/www/fcms
    2. sudo git clone https://github.com/ryanhowdy/fcms.git .
    3. composer install
    4. npm install
    5. cp .env.example .env
    6. php artisan key:generate
    7. sudo chown -R $USER:www-data storage
    8. sudo chown -R $USER:www-data bootstrap/cache
    9. chmod -R 775 storage
    10. chmod -R 775 bootstrap/cache
  12. (Optional) Install SSL Cert

    1. Use Let's Encrypt

Home

Contribute

User Documentation

Clone this wiki locally