We are still actively working on the spam issue.

Difference between revisions of "Setting up a Server"

From InstallGentoo Wiki
Jump to: navigation, search
(Updating setup to reflect changes made to home server)
m (Formatting and minor corrections)
Line 20: Line 20:
 
[[Setting up a Server/Choosing an Operating System|Choosing an Operating System]]
 
[[Setting up a Server/Choosing an Operating System|Choosing an Operating System]]
  
=Setting up your services=
+
=Recommended software=
Most packages have clear tutorials on their repo/project site. Here are some handpicked guides as well as some written by other anons.
+
*[[Home server#Server software]]
 +
*[[Home server#System administration software]]
  
 +
==Setting up your services==
 +
Most packages have clear tutorials on their repo/project site. Here are some handpicked guides for the most common types of software used
 
* SSH - OpenSSH
 
* SSH - OpenSSH
 
* Cloud Storage - Nextcloud
 
* Cloud Storage - Nextcloud
Line 28: Line 31:
 
* VPN - Wireguard
 
* VPN - Wireguard
 
* Media Streaming - Jellyfin
 
* Media Streaming - Jellyfin
 
=Recommended software=
 
[[Home server#Server software]]
 
[[Home server#System administration software]]
 
  
 
=Centralized storage=
 
=Centralized storage=
Line 52: Line 51:
 
[https://certbot.eff.org/ Certbot] makes https easy to implement with Let's Encrypt certificates
 
[https://certbot.eff.org/ Certbot] makes https easy to implement with Let's Encrypt certificates
  
==Remote access via SSH==
+
==Remote access==
 +
===GNU/Linux or BSD based systems===
  
=== GNU/Linux or BSD based systems ===
+
* You usually enable the ssh server during the installation. Do this if possible, it is the simplest way.
 
+
* If you did not setup sshd to auto start you can type:
# You usually enable the ssh server during the installation. Do this if possible, it is the simplest way.
+
** <code>/etc/rc.d sshd start</code>, if you use System V init.
# If you did not setup sshd to auto start you can type:
+
** <code>systemctl enable sshd.service && systemctl start sshd</code>, if you use systemd.
:* <code>/etc/rc.d sshd start</code>, if you use System V init.
+
* If that does not work, you need to install <code>sshd</code> or <code>openssh-server</code> with your package manager.
:* <code>systemctl enable sshd.service && systemctl start sshd</code>, if you use systemd.
 
# If that does not work, you need to install <code>sshd</code> or <code>openssh-server</code> with your package manager.
 
  
 
* Edit the sshd config in <code>/etc/ssh/sshd_config</code>
 
* Edit the sshd config in <code>/etc/ssh/sshd_config</code>
  
=== On [[Windows]] ===
+
===[[Windows]]===
 +
>ISHYGDDT
  
* Download [http://cygwin.com/install.html Cygwin]
+
# Download [http://cygwin.com/install.html Cygwin]
* Choose "Install From Internet"
+
# Choose "Install From Internet"
* Choose a mirror to download from
+
# Choose a mirror to download from
* When you get to the "Select Packages" screen, search SSH
+
# When you get to the "Select Packages" screen, search SSH
* Choose to install the "Bin" version of the "openssh" package
+
# Choose to install the "Bin" version of the "openssh" package
* Download all dependencies and wait for setup to complete
+
# Download all dependencies and wait for setup to complete
* Open Cygwin and wait for the initial setup to complete
+
# Open Cygwin and wait for the initial setup to complete
* Type "ssh-host-config" without the quotes
+
# Type "ssh-host-config" without the quotes
* Say yes when you get asked about privilege separation
+
# Say yes when you get asked about privilege separation
* Say yes when asked to create a local user named sshd
+
# Say yes when asked to create a local user named sshd
* Say yes when asked to install sshd as a service
+
# Say yes when asked to install sshd as a service
* When you see "CYGWIN=", type "ntsec tty" without the quotes ([http://www.chinese-watercolor.com/LRP/printsrv/cygwin-sshd.html this guide]explains why)
+
# When you see "CYGWIN=", type "ntsec tty" without the quotes ([http://www.chinese-watercolor.com/LRP/printsrv/cygwin-sshd.html this guide]explains why)
* You should be done now setting up the SSH server. To start it, type "net start sshd" without the quotes.
+
# You should be done now setting up the SSH server. To start it, type "net start sshd" without the quotes.
  
 
If you see:
 
If you see:
Line 87: Line 86:
 
Then everything went correctly. If not, you should Google the error.
 
Then everything went correctly. If not, you should Google the error.
  
=== On [[OS X]] ===
+
===[[OS X]]===
 
 
 
Simply go into sharing permissions and enable fucking everything.
 
Simply go into sharing permissions and enable fucking everything.
  
 
=== Post-setup ===
 
=== Post-setup ===
 
 
* Forward port 22 to the server ([http://portforward.com/ Here's a guide if you don't know how])
 
* Forward port 22 to the server ([http://portforward.com/ Here's a guide if you don't know how])
 
* OPTIONAL: [[Setting_up_a_Server#Domain_and_static.2Fdynamic_IP|Assign the server an address]], so you can type ''server.com'' instead of XXX.XXX.XXX.XXX ([http://lifehacker.com/software/web-publishing/geek-to-live--how-to-assign-a-domain-name-to-your-home-web-server-124804.php Read this])
 
* OPTIONAL: [[Setting_up_a_Server#Domain_and_static.2Fdynamic_IP|Assign the server an address]], so you can type ''server.com'' instead of XXX.XXX.XXX.XXX ([http://lifehacker.com/software/web-publishing/geek-to-live--how-to-assign-a-domain-name-to-your-home-web-server-124804.php Read this])
Line 107: Line 104:
  
 
=Security=
 
=Security=
[[Setting up a Server/Security]]
+
 
  
 
=External links=
 
=External links=
Line 116: Line 113:
  
 
=See also=
 
=See also=
[[Home server]]
+
* [[Home server]]
[[Setting up a Server/Home or Remote?|Home or Remote server?]]
+
* [[Setting up a Server/Home or Remote?|Home or Remote server?]]
[[Setting up a Server/Choosing an Operating System|Choosing an Operating System]]
+
* [[Setting up a Server/Choosing an Operating System|Choosing an Operating System]]
[[Setting up a Server/Mail|Mail]]
+
* [[Setting up a Server/Mail|Mail]]
[[Setting up a Server/DNS|DNS]]
+
* [[Setting up a Server/DNS|DNS]]
[[Setting up a Server/Security]]
+
* [[Setting up a Server/Security]]
  
 
[[Category:Tutorials]]
 
[[Category:Tutorials]]
 
[[Category:HowTo]]
 
[[Category:HowTo]]

Revision as of 11:27, 20 December 2020

Need to email? Set up a web server? Well, here's some advice. We're gonna try to write this page like you've never done this shit before. It does, however, assume you have at least some basic GNU/Linux knowledge. If you don't, you probably aren't ready for this. You weren't going to set up a server using Windows, were you? Jesus Christ, how horrifying.

A lot of this applies to both a home server as well as a VPS setup.

Common uses for a server

  • Install a media player system and stream content to your local network
  • Install a cloud service like Nextcloud to run your own Dropbox service, no privacy issues, full control, unlimited space (well, limited by how many drives you can cram in).
  • Always on seedbox. Start torrents with your phone through the web interface while out, they're done by the time you're back home.
  • Host a personal website.
  • Run your own mailserver just like Hillary!
    • Warning: Running a mailserver is a shitton of work. You will get hacked all the fucking time and it's very high-maintenance.
  • Run a dedicated game server.
  • Run various webapps, develop your own webapps.
  • SSH-tunnel to the server from work/school/etc to use it as a proxy, so that the admin of the network you're on can't see what sites you're going on.
  • Run a VPN for location spoofing or security when you're out and about.

Getting Started

Home or Remote?

Choosing an Operating System

Recommended software

Setting up your services

Most packages have clear tutorials on their repo/project site. Here are some handpicked guides for the most common types of software used

  • SSH - OpenSSH
  • Cloud Storage - Nextcloud
  • Web Server - apache2
  • VPN - Wireguard
  • Media Streaming - Jellyfin

Centralized storage

A server is perfect for this job. It is (supposedly) an always available resource on the local network. If using this in your house, you can expect reasonable speeds, even over WiFi that will let you do many daily tasks. One option is to set it up with NFS (Linux-centric, can be used on windows but it's shit) or Samaba if you have Windows clients on your network, so you can watch your chinese cartoons on any device and keep your documents/whatever synchronised. This synchronisation is a key benefit of the network storage.

You may want to consider a RAID array for long-term file storage. RAID is not backup, but will protect your files in case of drive failure. See Home server#File Systems and RAID for more information.

Web server

A reminder why you should always self-host and if you don't, avoid inbred retards
A reminder why you should always self-host and if you don't, avoid inbred retards

A web server serves up a page. The nice things about serving it from a server, than, say, Wordpress or your Dropbox share, is that now you can run web apps and server side code for a dynamic page.

Keep in mind that many server software installs (such as email with) involve setting up a webserver, so you may not even need to do anything.

HTTPS

The extra CPU burden of TLS is minuscule. Your server should serve up everything on HTTPS only. Keep port 80 (plain HTTP) open but redirect everything to HTTPS. If port 80 is closed, typing the address of your server into the address bar of a browser will probably fail (because the browser assumes you meant HTTP, but you have to go to HTTPS).

Issue a self-signed certificate. CAs are for jerks. Set the duration short (eg. a year) and don't forget to make a new one. If you've got a domain, get a Lets Encrypt-signed cert and set up a cron job to renew it. They're pretty sweet.

Certbot makes https easy to implement with Let's Encrypt certificates

Remote access

GNU/Linux or BSD based systems

  • You usually enable the ssh server during the installation. Do this if possible, it is the simplest way.
  • If you did not setup sshd to auto start you can type:
    • /etc/rc.d sshd start, if you use System V init.
    • systemctl enable sshd.service && systemctl start sshd, if you use systemd.
  • If that does not work, you need to install sshd or openssh-server with your package manager.
  • Edit the sshd config in /etc/ssh/sshd_config

Windows

>ISHYGDDT

  1. Download Cygwin
  2. Choose "Install From Internet"
  3. Choose a mirror to download from
  4. When you get to the "Select Packages" screen, search SSH
  5. Choose to install the "Bin" version of the "openssh" package
  6. Download all dependencies and wait for setup to complete
  7. Open Cygwin and wait for the initial setup to complete
  8. Type "ssh-host-config" without the quotes
  9. Say yes when you get asked about privilege separation
  10. Say yes when asked to create a local user named sshd
  11. Say yes when asked to install sshd as a service
  12. When you see "CYGWIN=", type "ntsec tty" without the quotes (this guideexplains why)
  13. You should be done now setting up the SSH server. To start it, type "net start sshd" without the quotes.

If you see:

The CYGWIN sshd service is starting. 
The CYGWIN sshd service was started successfully.

Then everything went correctly. If not, you should Google the error.

OS X

Simply go into sharing permissions and enable fucking everything.

Post-setup

Media automation

Torrenting

Use a daemon like Transmission or Deluge.

TV Series

You can use a daemon like Sickbeard

Movies

You can use a daemon like Couchpotato

Music

You can use a daemon like Headphones

Security

External links

See also