Normally I prefer Ubuntu servers but I needed a CentOS Server ( info ) for some software, this guide is a quick guide that lists anything that is different to setting up an Ubuntu server.
Buying a Domain
Buy a domain name from Namecheap here.
Creating a CentOS Server
If you get stuck check out my Ubuntu Digital Ocean guide here or my Ubuntu on AWS guide here.
Login to Digital Ocean (get 2-month free by using my referral link here).
Update 2018: For the best performing VM host (UpCloud) read my guide on the awesome UpCloud VM hosts (get $25 free credit by signing up here).
Create and deploy a CentOS 7.2 64 bit Server at Digital Ocean.
Reset your root password (so we can log-in via telnet and install node-js before we connect to C9.io).
Log-in to the server with ssh
Setting the timezone is different than Ubuntu.
Setup NPT time sync daemon
Setup a Swap file
Update Packages
Install Common Packages
Monitor Open Ports:
More info on ports and firewalls here.
Install the Links text based browser
Install Apache
yum install httpd
Install the nano text editor
yum install nano
Configure Apache to listen on port 80: Edit /etc/httpd/conf/httpd.conf and add LISTEN 80
listen 80
Note the location of your http docs root folder (DocumentRoot: “/var/www/html“).
Firewall configuration (more info here)
Buy a domain from NameCheap then go to Digital Ocean droplet list and assign the domain name to the droplet (see the guide here).
Summary:
Goto Namecheap and point the domain to custom DNS ( ns1.digitalocean.com, ns3.digitalocean.com and ns3.digitalocean.com ), remove the placeholder domain just provisioned warning,
On your server (SSH) run the following command
Configure centos Apache to redirect www.yourdomain.com to yourdomain.com (guide here).
Wait or your domain to be available (can you access it via www.yourdomainname.com and yourdomainname.com).
I did add these lines to the following files (/etc/cloud/templates/hosts.redhat.tmpl ) as my www. was not loading (I am not sure if it helped).
Then restarted the network.
I then write an .htaccess redirect to sent all requests to www.mydomainname.com
Configure Apache Root Folder
Now I can view my website 🙂
Time to create a default page.
Installing PHP
systemctl restart httpd
Install MariaDB
Configure MariaDB
Install an FTP Server
yum install vsftpd
Todo: Add local user…
Install nodejs
Connect the server to c9.io
Now the server is ready to connect to c9.io.
Security
As a precaution do check your website often in https://www.shodan.io and see if it has open software or is known to hackers.
Firewall was blocking connections after reboot
Install SSL
todo…
Lock down the server (remove the root account etc)
Todo: Remove root logins, secure mariadb etc
todo..
Thanks to the following guides that helped me:
http://www.tecmint.com/things-to-do-after-minimal-rhel-centos-7-installation/2/
https://www.digitalocean.com/community/tutorials/initial-server-setup-with-centos-7
Donate and make this blog better
Ask a question or recommend an article
[contact-form-7 id=”30″ title=”Ask a Question”]