W.F. (Write Freely)

Installation of Write Freely is pretty basic, if, that is, you understand “terminal.” There are tons of lessons for learning to use terminal and once you’ve studied a bit it should be uncomplicated. As you work through this tutorial watch for EXIT. This takes you from user back to root. Code can only be utilized as your user or root and the two are not compatible with certain installation procedures.

We begin in root user. Code is in between the three TAB dots > “`

Write Freely

```
	useradd -r -m -d /srv/writefreely -s /bin/bash writefreely
	 
	usermod -a -G www-data writefreely
	 
	su - writefreely
```
Download from GIT

```
wget  https://github.com/writefreely/writefreely/releases/download/v0.15.1/writefreely_0.15.1_linux_amd64.tar.gz

tar xvzf writefreely_0.15.1_linux_amd64.tar.gz

mv writefreely example.com
```

EXIT

Install Maria DB
```
apt install mariadb-server

mysql -u root -p

CREATE DATABASE writefreely;
	
GRANT ALL PRIVILEGES ON writefreely.* TO 'username'@'localhost' IDENTIFIED BY 'yoursimplepass';
```
EXIT
Generate config
```
su - writefreely
	 
cd dominio.com
	 
./writefreely --config
```
	In the generated file, we will modify the following data:
	 
	 
	username = your user
	password = simple pass for now.
	database = writefreely
	site_name = My Wondrous Blog
	site_description = Short Blog Description
	host = https://example.com
	default_visibility = public

	Once the file is modified we save it (control + X, and we give it to itself). Then we type the following codes to generate the encryption key and the administrator user.

	./writefreely db init
	 
	./writefreely keys generate
	 
	./writefreely --create-admin username:simple password

	
We will create the service in Systemd and add its content from the root user (you have to exit the writefreely user, if you don't know it's just writing- exit):

EXIT to root
```
	nano /etc/systemd/system/writefreely.service
```

	[Unit]
	Description=WriteFreely Instance
	After=syslog.target network.target mysql.service
	 
	[Service]
	Type=simple
	StandardOutput=syslog
	StandardError=syslog
	 
	User=writefreely
	Group=www-data
	 
	WorkingDirectory=/srv/writefreely/example.com
	 
	ExecStart=/srv/writefreely/example.com/writefreely
	 
	Restart=always 
	 
	[Install]
	WantedBy=multi-user.target

	After this we save the file (control + X, and press ENTER) and continue:
```
	systemctl daemon-reload
	 
	systemctl start writefreely
	 
	systemctl enable writefreely
```
	Now we will start a very important part, configure Nginx:
```
	apt install nginx certbot python3-certbot-nginx
	 
	nano /etc/nginx/sites-available/writefreely.conf
```

With the last code we have created a file where we will write the following, remembering to change domain.com for your domain:

server {
    listen 80;
    listen [::]:80;

    server_name example.com;

    gzip on;
    gzip_types
      application/javascript
      application/x-javascript
      application/json
      application/rss+xml
      application/xml
      image/svg+xml
      image/x-icon
      application/vnd.ms-fontobject
      application/font-sfnt
      text/css
      text/plain;
    gzip_min_length 256;
    gzip_comp_level 5;
    gzip_http_version 1.1;
    gzip_vary on;

    location ~ ^/.well-known/(webfinger|nodeinfo|host-meta) {
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $remote_addr;
        proxy_pass http://127.0.0.1:8080;
        proxy_redirect off;
    }

    location ~ ^/(css|img|js|fonts)/ {
        root /srv/writefreely/example.com/static;
        # Optionally cache these files in the browser:
        # expires 12M;
    }

    location / {
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $remote_addr;
        proxy_pass http://127.0.0.1:8080;
        proxy_redirect off;
    }
}

We save the file and enable it:
```
	cd /etc/nginx/sites-enabled/
	 
	ln -s ../sites-available/writefreely.conf
	 
	nginx -t
	 
	systemctl reload nginx
```
And to finish, we go with the certbot:
```
	apt install -y certbot python3-certbot-nginx
	 
	certbot
```

That's It!

Answer the three questions thusly: email for certbot - one of your email addresses for expiration notices from certbot.

Next answer - Y

Next Answer - N

Next Answer - 1

You're done. Go to your URL and log in using upper left "LOGIN"

I wish you happy blogging. If you fail, try, try again. Make frequent backups or snapshots while installing if you are unsure of how this works. It is much easier than reinstalling a server over and over. This is written for Debian 11-12 but should work with Ubuntu, if that is your preference. I’ve not tried it with Ubuntu.

Views: 205

Odd T.C.