# [Newbie] What are the vital things after setting up VPS?



## hayvan (Apr 26, 2014)

Well, I'm very new at setting and managing VPS. Basically I would like to use a 1 GB DO plan with CentOS 6.5 x 64 and cPanel. There will be one small scaled OpenCart based eCommerce site on the server. 

So, what are the absolute must things after installing cPanel? Please consider that I'm newbie and every single detail is invaluable for me. For example:

1 - Change root password

2 - Install firewall

3 - Create swap image if you have low memory

4 - Optimize MySQL (I don't know how, will read about it a lot)

.

.

.

.


----------



## MannDude (Apr 26, 2014)

Hey there, welcome to vpsBoard.

Luckily for you, cPanel makes managing a server quite easy. Even when you encounter issues or have a question, the software is in use by so many that if the official cPanel documentation fails to cover it, then you can rest assured that the question has been asked (and answered) either on their community forum or elsewhere.

Installing cPanel is easy, it's just a few command lines you can copy/paste, the install is more or less automated and will take 30-60 minutes depending on the server. You'll have a few setup questions once you login to WHM for the first time, but more than likely the defaults will be fine for you. I'd still advise you read every prompt and just be aware of what you're clicking on.

Root password can be changed via WHM or from the command line itself by simply using the 'passwd' command when logged in as root. Pretty simple.

I'd recommend CSF for the firewall. It's also heavily used, heavily documented. Installation is also a breeze: http://configserver.com/free/csf/install.txt I also like CSF because you can run the tool to check your server hardening and can toggle on detailed explanations and follow the instructions.

Unsure about DigitalOcean's setup, though I know it's KVM based. Setting the swappiness is also quite easy. IBM has good documentation here: http://pic.dhe.ibm.com/infocenter/lnxinfo/v3r0m0/index.jsp?topic=%2Fliaat%2Fliaattunsetswapiness.htm Should be noted you probably wouldn't have to worry about this and if you're using swap often you'll likely find that upgrading the actual RAM (or reducing usage) to be more beneficial to you.

Optimizing MySQL isn't as difficult as you may think. They make some pretty nifty tools to assist with this and guide you, the most popular of which would be MySQLtuner.pl (https://raw.githubusercontent.com/major/MySQLTuner-perl/master/mysqltuner.pl) There may also be some cPanel specific guides that exist too.

If you're in North America, cPanel will mail you FREE reference posters, which may or may not be handy to you. I've some hanging on the wall but I find Googling easier than squinting my bad eyes at a glossy poster.


----------



## jenok (Apr 26, 2014)

Get nginx into your cpanel to boost a bit of your site performance


----------



## hayvan (Apr 26, 2014)

@ jenok

Can I use nginx with Apache? It's convenient for eCommerce system? I don't know how it's working principle but from i understand from the forum discussions, it is very good for static pages. 

@ Manndude,

Thank you very much for great answer. But honestly I already know what you explained above. I have created lots of droplets and destroyed them. Learnt many things with reading documents and trial-and-error. Actually I have asked what should I consider out of the list. I just need to find out indispensable things before transferring live site. Or can I use cPanel like plug-and-play style? 

I've really many questions  But I know I cannot learn all of them in a short time. I tested OpenCart on localhost via Xampp 1.8.3 and experienced the latest version of the cart is running on PHP 5.5.11, Apache 2.4.9 and MySQL 5.6.16 very smooth.

So upgrading things on Easyapache would be fine for me? Anyways, if you would like to make a to do list after installing cPanel on a server, what would it be? In other words, for secure and faster server, which things a newbie must do after making a fresh cPanel install?


----------



## jenok (Apr 26, 2014)

hayvan said:


> @ jenok
> 
> Can I use nginx with Apache? It's convenient for eCommerce system? I don't know how it's working principle but from i understand from the forum discussions, it is very good for static pages.


Yes, you can get nginx and apache works together for the eCommerce system, as I said in my previous reply it could be boost *a bit* of your site performance since you will have some portion of your site having static pages.


----------



## hayvan (Apr 26, 2014)

And I forgot to ask. What should I do for installing SSL on my user account? As I said before I will use only one site on the server. I have created a user with unlimited resources. But the IP seems shared instead of dedicated on the panel. Can I use this IP for SSL?


----------



## DomainBop (Apr 26, 2014)

> Well, I'm very new at setting and managing VPS. Basically I would like to use a 1 GB DO plan with CentOS 6.5 x 64 and cPanel. There will be one small scaled OpenCart based eCommerce site on the server.


cPanel uses a lot of RAM (and there is a monthly fee) and eCommerce scripts can also be resource hogs so you won't have much room for growth with a 1GB VPS if you install CPanel.  What I would suggest doing is using Centminmod (http://centminmod.com/ ) instead of CPanel.  Centminmod is a command line tool but has an easy to follow menu and it's very easy to setup a webserver with it. It also includes installs for APCcache/Xcache and memcached which will improve the performance of your store.  If you search google you'll find a ton of tutorials on adding nginx rewrite rules for Opencart so you won't need Apache.

In addition to centminmod you would need to install an email program for outgoing mail for your store (exim is easy to install and there are countless tutorials), an SSL certificate (not hard to do), a firewall (CSF practically installs itself), and I would also suggest fail2ban (also easy to install).

I would also suggest getting a 1GB VPS at Vultr instead of DO because the Vultr VPS's have over 2X the CPU power as DO's offerings.  Vultr's control panel is as easy to use as DO's, their prices are a little less, their network is better, _and they don't use RAID 5_.


----------



## jcarney1987 (Apr 26, 2014)

centminmod does look nice for a novice user and a great advantage for a low budget vps.  I'll have to check that out some more, thanks for putting that out there.

As to answer the OP questions.

Change SSH port to a non default port.

Rebuild apache with each apache with only what you need.

Add security layers to apache with mod sec and mod evassive for starters.

Disable SSH password authentication, but besure you have a working key to get back into your system via SSH.  Can be done through security in Cpanel. 

Install RKhunter/Chrootkit

Those are just a couple things I could think off the top of my head.


----------



## hayvan (Apr 27, 2014)

Thanks all, should I use MPM? There are there MPMs and prefork recommended.


----------



## tonyg (Apr 27, 2014)

Forget all the front end panels...learn the shell ie. command line.


----------



## hayvan (Apr 27, 2014)

tonyg said:


> Forget all the front end panels...learn the shell ie. command line.


I will do it. But I have to transfer our eCommerce site to VPS as soon as possible. I need time to learn shell and I prefer to do it on a test server. Can't risk a live site. Thanks anyways.


----------



## hayvan (May 3, 2014)

I used tuning-primer.sh 

What do you think about the result?


```
MySQL Version 5.6.16 x86_64

Uptime = 5 days 21 hrs 2 min 38 sec
Avg. qps = 0
Total Questions = 103130
Threads Connected = 1

Server has been running for over 48hrs.
It should be safe to follow these recommendations

To find out more information on how each of these
runtime variables effects performance visit:
http://dev.mysql.com/doc/refman/5.6/en/server-system-variables.html
Visit http://www.mysql.com/products/enterprise/advisors.html
for info about MySQL's Enterprise Monitoring and Advisory Service

SLOW QUERIES
The slow query log is NOT enabled.
Current long_query_time = 10.000000 sec.
You have 0 out of 103151 that take longer than 10.000000 sec. to complete
Your long_query_time seems to be fine

BINARY UPDATE LOG
The binary update log is NOT enabled.
You will not be able to do point in time recovery
See http://dev.mysql.com/doc/refman/5.6/en/point-in-time-recovery.html

WORKER THREADS
Current thread_cache_size = 9
Current threads_cached = 8
Current threads_per_sec = 0
Historic threads_per_sec = 0
Your thread_cache_size is fine

MAX CONNECTIONS
Current max_connections = 151
Current threads_connected = 1
Historic max_used_connections = 9
The number of used connections is 5% of the configured maximum.
You are using less than 10% of your configured max_connections.
Lowering max_connections could help to avoid an over-allocation of memory
See "MEMORY USAGE" section to make sure you are not over-allocating

INNODB STATUS
Current InnoDB index space = 4 M
Current InnoDB data space = 2 M
Current InnoDB buffer pool free = 92 %
Current innodb_buffer_pool_size = 128 M
Depending on how much space your innodb indexes take up it may be safe
to increase this value to up to 2 / 3 of total system memory

MEMORY USAGE
Max Memory Ever Allocated : 163 M
Configured Max Per-thread Buffers : 169 M
Configured Max Global Buffers : 153 M
Configured Max Memory Limit : 322 M
Physical Memory : 996 M
Max memory limit seem to be within acceptable norms

KEY BUFFER
Current MyISAM index space = 818 K
Current key_buffer_size = 8 M
Key cache miss rate is 1 : 171953
Key buffer free ratio = 78 %
Your key_buffer_size seems to be too high.
Perhaps you can use these resources elsewhere

QUERY CACHE
Query cache is enabled
Current query_cache_size = 1 M
Current query_cache_used = 16 K
Current query_cache_limit = 1 M
Current Query cache Memory fill ratio = 1.64 %
Current query_cache_min_res_unit = 4 K
Your query_cache_size seems to be too high.
Perhaps you can use these resources elsewhere
MySQL won't cache query results that are larger than query_cache_limit in size

SORT OPERATIONS
Current sort_buffer_size = 256 K
Current read_rnd_buffer_size = 256 K
Sort buffer seems to be fine

JOINS
Current join_buffer_size = 260.00 K
You have had 207 queries where a join could not use an index properly
You should enable "log-queries-not-using-indexes"
Then look for non indexed joins in the slow query log.
If you are unable to optimize your queries you may want to increase your
join_buffer_size to accommodate larger joins in one pass.

Note! This script will still suggest raising the join_buffer_size when
ANY joins not using indexes are found.

OPEN FILES LIMIT
Current open_files_limit = 5000 files
The open_files_limit should typically be set to at least 2x-3x
that of table_cache if you have heavy MyISAM usage.
Your open_files_limit value seems to be fine

TABLE CACHE
Current table_open_cache = 2000 tables
Current table_definition_cache = 1400 tables
You have a total of 333 tables
You have 359 open tables.
The table_cache value seems to be fine

TEMP TABLES
Current max_heap_table_size = 16 M
Current tmp_table_size = 16 M
Of 37666 temp tables, 29% were created on disk
Perhaps you should increase your tmp_table_size and/or max_heap_table_size
to reduce the number of disk-based temporary tables
Note! BLOB and TEXT columns are not allow in memory tables.
If you are using these columns raising these values might not impact your
ratio of on disk temp tables.

TABLE SCANS
Current read_buffer_size = 128 K
Current table scan ratio = 172 : 1
read_buffer_size seems to be fine

TABLE LOCKING
Current Lock Wait ratio = 0 : 103406
Your table locking seems to be fine
```


----------



## vps24.net (May 4, 2014)

If You are not very familiar with linux systems itself - let the cPanel do the job for You.

cPanle offers many functions which makes easy managing systems - also in quite advanced areas.

regs.

http://www.vps24.net


----------

