Hi all,
Still new to Linux so please forgive me if I’ve missed something 
Im trying to install a program onto Ubuntu server 16.04 (with mate GUI) and can not add a file to the /etc/systemd/system directer y. The program that Im using says to add a .service file to this location however it is read only. Is there a way to add a file as root?
Thanks!
You need to either run the explorer window as root (not recommended) or use the command line to create the file, as root (recommended, best practice).
Linux is different from windows in a lot of ways. One way is that we typically do most non-trivial config (creating services included) from the command line.
Most file explorers don’t include a “get root privileges” option to prevent you from accidentally doing damage to your system and because as a user working from a GUI, you shouldn’t be working with root permissions on files. Non-root should be enough for most day to day operations.
I’m not sure how familiar you are with the terminal, but allow me to give you a few pointers: the nano command is a basic text editor that you can use to create and edit files from the CLI. That’s probably where you want to start off. sudo will run a command as root, so to edit a file, as root, in the /etc/systemd/system directory, you would use the following command:
sudo nano /etc/systemd/system/filename.service
Brilliant! that got it. Thank you very much, saved many hours of googling and headache!
What sgtawesomesauce is saying is correct. Another way to do it would be to create the service file in a folder that your user has write access to, and then copy it to /etc/systemd/system/. But when you copy it, you will need to do so with sudo. This is because the folder /etc/systemd/system/ is owned by root, and not your user account. Don’t worry, this is by design, and I advise against changing the permissions of system files/folders. Best practice is to do things with sudo. If you would like to learn more about how permissions work, this is a good resource: https://wiki.debian.org/Permissions . But without getting too technical, mostly everything in root (or '/') will be owned by root; and readable by others but not writable. Everything under /home/$USER will be owned by $USER unless the file is created with sudo in which case it will be owned by root.
Hope that helps a little.
I was thinking that it might be able to be done that way but I was unsure of the command, thanks!
If you’re not super familiar with the command line, the following videos may be beneficial to you.
Awesome! ill take a look at them!
Looks like this is already solved.
Still, here’s an article I found way back when, that explains how to make your own systemd service: https://www.manniwood.com/postgresql_94_in_ram/index.html
The top half of the article is about database specific settings, the last half is the script. It has tons of comments explaining what each part does, found it really useful.
Cheers!