Setting up a server

22 replies [Last post]
GNUbahn
Offline
Joined: 02/18/2016

Hi.

I have for long wanted to setup my own server but every time I get stock. There are loads of sites apparently explaining and illustrating how to do including https://trisquel.info/en/wiki/server

Yet I haven't found one that helps me - with my level of (lack of) knowledge - sufficiently to understand what is needed, how to install it and how to set it up.

I wish to be able to host a few sites (i.e. a number of domains) like simple pages, blogs etc. I would like some sort of upload via email system (i.e. I send an email to a specific address which posts the content on my site)

I also wish to setup my own
* email server
* encrypted file storage (with multiple users so I can host e.g. my cousins back-up files without me being able to know their content)
* encrypted etherpad

LATER I would like to learn how to setup
* a vpn service
* a tor node
* a video/chat instance
and more

So I want to start with a server that can host simple pages and blogs and later be 'upgraded' to host various features like the ones mentioned above.

First question: Which computer should I use? Naturally I want to run free software exclusively, i.e. on Libreboot and Trisquel. Will it suffice with a T60? Will it be much better with X200 or a T400, or should I use something else? Are there some minimum requirements or recommendations regarding CPU, RAM, bandwidth etc.?

Secondly, I need to know which software to install. If it is not too difficult or cumbersome I would like to start by setting up a basic server which I can later 'expand' to the more advanced features (rather than having to install totally different server software later).

Thirdly I need to know how to set it all up to ensure the proper functionality and privacy/security.

One issue I really don't understand is how to make the server accessible from the internet.

I hope you guys will help me with advise, knowledge and links to good reads. Since I do not have much spare time, this project will probably last some time. On top of getting my own server, I hope to be able to make a good guide based on my experiences and the synthesis of your help.

jxself
Offline
Joined: 09/13/2010

To start off with a web server install Apache. sudo apt install apache2 ta da.

chaosmonk

I am a member!

I am a translator!

Offline
Joined: 07/07/2017

I found this guide[1] helpful in setting up a basic server to serve
static web pages. Here is a basic summary of the first steps.

Install Apache.

$ sudo apt install apache2

Configure the firewall.

$ sudo ufw enable
$ sudo ufw allow 'Apache Full'

Determine your IP address.

$ hostname -I

In your browser, go to

http://[your ip address]

and you should see Trisquel's default Apache page. To modify this page,
edit "/var/www/html/index.html".

[1] https://www.digitalocean.com/community/tutorials/how-to-install-the-apache-web-server-on-ubuntu-16-04

GNUbahn
Offline
Joined: 02/18/2016

If no issues occur I can do this.

But if I am not wrong, this will not render it possible to access my server form the outside, right? $ hostname -I appears to give me my local IP.

How do I connect the server/page with a domain, e.g. gnubahn.dk?

Next step is to design the page. I will probably need some sort of template for my first shot.
I would appreciate links to pages explaining how to design or setup an actual page.

But again: To start with I need to settle on which computer to install apache on.

Btw, is there an easy answer to why Apache is the best choice?

GNUbahn
Offline
Joined: 02/18/2016

Thanks for the advise, jxself and chaosmunk.

I still need to start at the beginning though: What computer specs are necessary?

Will a T60 suffice?
What are the main possible bottle necks?

nadebula.1984
Offline
Joined: 05/01/2018

If you mean ThinkPad T60, it supports only 3 GiB of memory.

GNUbahn
Offline
Joined: 02/18/2016

Yes, I mean a Thinkpad T60. I know it supports 3GB RAM, but does it as a whole suffice for a server?

jxself
Offline
Joined: 09/13/2010

Sure. But don't just take our word for it: You can experiment you know and learn from experience. :)

GNUbahn
Offline
Joined: 02/18/2016

Thanks for wanting the best for me.

Learning from experience can take many forms and while I in many cases prefer my own unspoiled experiences, in this case I would like some guidance. That is, gain a specific goal by the aid of one or more knowledgeables. You might say that under the given conditions the task of learning everything by own and unspoiled experience is too demanding for me to be able to turn it into a positive learning experience.

It is not crucial at the time, but I am sure that even with guidance, this will be an experiment for me.

So, thanks for the encouragement, but at this point I would appreciate your knowledge about servers more than your good intentions for my learning.

Libreshop
Offline
Joined: 10/27/2018

If you just want to host static files. Just installing apache is enough, there is also nginx, which works the same way, just configuration is different. Use the one you are familiar with.

You don't need to change to another server if you plan to host only static server. Most of the other things(you mentioned) can also be installed next to it. But if you are going to have lots of users, which will use all those programs, then you can consider upgrading to x200/T400 or to servers mentioned at Libreboots website with more ram/cpu/disc-space.

Or another way is to host everything on different less powered servers, so each one performs only specific task.

For hosting from home, you need to do couple of things.
1) open port 80 and 443 at your isp's website. (Most isp's blocks them for "security" reason)
2) if you received a router from your isp, with custom firmware, open the ports there as well.
2.1) you need to forward those ports to your servers (local)ip address.
3a) if you have a static ip, go to your search provider and type "what is my ip", if you dont use a vpn service(nordvpn, expressvpn, ...) or tor, then you can see your ip, provided by your isp)
3b) if you don't have static ip from you isp, subscribe to a dynamic dns service(no-ip.com, dyndns.com, ...) (I will use dyndns in this post as an example, but you are free to use another)
3b.1) if it's possible, set the dyndns credentials in your routers gui
3b.2) if router isn't an option, install dyndns client in your server and enter your credentials.
3b.3) if you don't want to do that, try to find the endpoints of dyndns, and make a cron job on your server(every hour), to make an http request to that endpoint using curl or wget. So it will update your ip every hour.

Be carefull: when you host from home, your ip and location will be tracable.
If it is possible, set a vlan on your router, so you separate your server traffic from your private traffic. If vlan is difficult, connect your servers directly to your router provided by your isp and disable wifi, connect another router(with librecmc) to a free ethernet port on your isp-router, and use the librecmc router to connect all your private devices, and you can setup vpn tor adblock, whatever you want in it and enable wifi.

Once your static server is setup, you can go to the url provided by dyndns(something like blablabla.dyn-dns.net), and you can see your webpage.

Btw, if you also want https access, use let's encrypt(https://certbot.eff.org/lets-encrypt/ubuntuxenial-apache), follow the steps there after installing apache.

GNUbahn
Offline
Joined: 02/18/2016

OK, so I will use a librebooted T60 for my server. It crruntly has 2GB of memory - I may have to increase that to 3GB (which is max).

I will install Trisquel from at netinstall image but when I dd the image to a usb stick it creates two partitions (sdb1 and sdb2). When dd'ing other trisquel images I only get one partition (i.e. sdb1). I have been using this command sudo dd if=trisquel-netinst_8.0_i686.iso of=/dev/sdb bs=8M;sync taken from https://trisquel.info/en/wiki/how-create-liveusb
It doesn't work. And I can't easily delete the partitions created on the usb stick. In fact the only way I have been able to do it is by creating a new partition table with gparted.

Q: What am I doing wrong and/or how can I solve that

As for the router issue raised by Libreshop above I will solve it by using two routers running libreCMC. That means that I will have a primary router, i.e. the one that is connected directly to 'the outside' and a secondary router which is 'behind'.

Q: Should I use the the primary or the secondary for my server traffic and how should I set the servers up, e.g. regarding vlan.

jxself
Offline
Joined: 09/13/2010

The Trisquel netinstalls are currently broken and have been for months: https://trisquel.info/en/issues/25533
It's sad; it means there's no way to do a minimal install currently. Your options are to use the graphical installer and then maybe remove packages after the install's done, install Trisquel via a chroot environment, or wait for the ISOs to be fixed. I have no idea how long that will be, since it's already been four months.

chaosmonk

I am a member!

I am a translator!

Offline
Joined: 07/07/2017

> The Trisquel netinstalls are currently broken and have been for months:
> https://trisquel.info/en/issues/25533
> It's sad; it means there's no way to do a minimal install currently.

The graphical ISO has a "text install" option that is the same thing as
a netinstall. The graphical ISO on the downloads page has the same
problem as the netinstall ISO, but this ISO[1] fixes the libc6-udeb
issue. It has another problem, though, which is that it fails when I
select the default kernel. A workaround is to select the HWE kernel
instead.

[1] http://jenkins.trisquel.info/makeiso/iso/trisquel_8.0_amd64.iso

jxself
Offline
Joined: 09/13/2010

"The graphical ISO has a "text install" option that is the same thing as a netinstall."

Yes, I didn't mention it because it too is borked.

chaosmonk

I am a member!

I am a translator!

Offline
Joined: 07/07/2017

> Yes, I didn't mention it because it too is borked.

Even the one I linked to?

GNUbahn
Offline
Joined: 02/18/2016

Since the netinstall isos and text mode installation do not work I will just use a Trisquel mini installation. I suppose that will work fine?

Now, I have installed apache2, mysql-server and php7.0-mysql which I believe to be the necessary software for the server part.

For my first page I want to setup a wordpress blog.

Wordpress in in the repository and I have installed it, but the terminal does not recognise 'wordpress' as a command.

Q: How do I setup wordpress in/on (which is the right terminology?) Apache?

dctrud (not verified)
dctrud

Generally, if you search the web for instructions on installing / setting up things like wordpress on Ubuntu 16.04 you will find a procedure that works on Trisquel 8.0 - as it is derived from Ubuntu 16.04. So a search for "wordpress install Ubuntu 16.04" should get you what you need.

One caution though is to be careful reading through any guide that suggests adding a repository / downloading software, so that you do not inadvertently add anything non-free if your goal (since you are using Trisquel) is to keep a free/libre system.

GNUbahn
Offline
Joined: 02/18/2016

One caution though is to be careful reading through any guide that suggests adding a repository / downloading software, so that you do not inadvertently add anything non-free if your goal (since you are using Trisquel) is to keep a free/libre system

And accordingly I install wordpress from trisquel's repo. Most guides include downloading the tar. A few install from repo, for instance this one: https://linoxide.com/ubuntu-how-to/easy-steps-installing-wordpress-on-ubuntu-using-apt-get/

It seems to work fine. After the final command sudo bash /usr/share/doc/wordpress/examples/setup-mysql -n wordpress localhost I should be able to 'start making [my] blog' when going to http://localhost/wordpress

But nothing happens!
I don't know what the 'sudo bash ...' command is supposed to do. If I am not wrong (which I very might be) localhost will read the .html file in /var/www/html but there is nothing in that folder which links to wordpress. In the /var/www/ folder there is a folder called 'wordpress' (i.e. next to the 'html' folder).

Any advise on how to make it work?

Magic Banana

I am a member!

I am a translator!

Offline
Joined: 07/24/2010

'sudo bash ...' executes the Shell script (in the "...") using the GNU Bash interpreter and administrative privileges. The script needs to be studied, if you want to know what it actually does to your system.

GNUbahn
Offline
Joined: 02/18/2016

The "..." is described above: sudo bash /usr/share/doc/wordpress/examples/setup-mysql -n wordpress localhost

Can you help to figure out why I didn't succeed?

Magic Banana

I am a member!

I am a translator!

Offline
Joined: 07/24/2010

Well, I have never setup MySQL, contrary to several people here, I believe. Was there an error message? If not, I doubt the problem relates to this script.

ALG
ALG
Offline
Joined: 08/27/2015

Hi! I setted up a Debian server a week ago for my first time. It's easy. To install Wordpress I recommend you to download the latest version on Wordpress website. You can use the www/html folder or another one according to your configuration. First: install apache2, php and mysql. Second: configure a file in sites-enabled (etc/apache2 folder) to enable your domain (or localhost). Restart apache2, be careful with php.ini and go to your browser and type your direction/index.php

If you want a very, very straightforward way (mainly for an email server), try Vesta CP, a 'libre' control panel that automatically installs everything you need: https://vestacp.com/

jxself
Offline
Joined: 09/13/2010

Although installing some sort of "control panel"-type of software also abstracts away pieces and can hinder learning because all you're doing is click on a button that says "do it." Especially when someone's new and is interested in learning things, as GNUbahn seems to be.

But if GNUbahn wants to go that route another one is http://webmin.com/