This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Full VPS Setup on CentOS
#1
Full VPS Setup on CentOS
This isn't as detailed as my Ubuntu Guide, but will you get you up and running with CentOS and will get you familiar with the OS and how it works.

To start with install CentOS 6/7. Once it's installed use this to login. Replacing "IP" with the server IP.

Code:
ssh -l root "IP"

then enter your password. To change the password run:

Code:
passwd

Next thing to do is install Sentora.

The script is pretty straightforward. Just make sure you pick Phoenix/Arizona/Mountain Standard Time so you don't have issues with daylight saving.

When it asks for "Enter the sub-domain you want to access Sentora panel"

Enter: Sub.YourDomain.com

Ideally the sub should be setup before you run the script, but can be done afterwards. The sub will be the address used to enter Sentora panel.

Code:
bash <(curl -L -Ss http://sentora.org/install)

Once the script finishes do not reboot (but make note of the passwords and save them).

Next run this:

Code:
yum install nano htop php-xcache xcache-admin

This will install XCache that will speed up page load times, htop an interactive process viewer and nano a text editor.

The next part is to edit the php.ini.

Code:
nano /etc/php.ini

Change these values to what you want them. If you are going to use phpMyAdmin to upload a database make sure upload_max_filesize is larger than your database:

Code:
post_max_size = 8M
upload_max_filesize = 2M
memory_limit = 64M

memory_limit should be about quarter of your total memory. So if your server has 1GB give it 256M, for 512M give it 128M.

F3 will save the file and Ctrl+X will exit nano.

Next we need to edit Apache.

Code:
nano /etc/httpd/conf/httpd.conf

Look for ServerName http://www.example.com:80

And enter your web address. If it has # at the beging of it remove it.

Save the file and reboot Apache.

Code:
service httpd restart

Next modify MySQL so it doesn't use to much memory.

Code:
nano /etc/my.cnf

And add this just underneath [mysqld]

Code:
#MyISAM
key_buffer_size = 16M
#May
need to be higher. Higher number more Memory usage
sort_buffer_size = 1M
read_buffer_size = 1M
read_rnd_buffer_size = 2M
myisam_sort_buffer_size = 2M
join_buffer_size = 2M
max_connections = 60
#If
you have issues with simultaneous connections increase this value
query_cache_type = 1
query_cache_size = 16M
#May
need to be higher.
query_cache_limit = 8M
thread_stack = 128K
thread_cache_size = 16M
table_definition_cache = 400
table_open_cache = 2000
table_cache = 2000
max_heap_table_size = 16M
#May
need to be higher
tmp_table_size = 16M
#Keep
equal to max_heap_table_size
connect-timeout = 20
low_priority_updates = 1
concurrent_insert = ALWAYS

Then save the file and reboot MySQL.

To better tune MySQL look here: http://www.joe0.com/2013/09/05/how-to-tu...tosredhat/

Code:
service mysqld restart

To update/repair all the MySQL tables run:

Code:
mysqlcheck -o --all-databases --user=root --password=*MySQL Password*

Daily backups is broken in Sentora. Running it makes multiple backups filling up the disc very quickly.
To avoid having any issues with this remove all the backup modules.

Code:
rm -rf /etc/sentora/panel/modules/backup_admin/hooks/*

To manually backup your sites to a zip for easy transfer run:

Code:
zip -r /var/sentora/hostdata/zadmin/backup.zip /var/sentora/hostdata/zadmin/public_html

To setup a Cron job for a weekly backup run:

Code:
nano /etc/cron.weekly/backup

And add this to the file:

Code:
#!/bin/sh
rm /var/sentora/hostdata/zadmin/backup.zip
zip -r /var/sentora/hostdata/zadmin/backup.zip /var/sentora/hostdata/zadmin/public_html
exit

F3 will save the file and Ctrl+X will exit nano.

Next set permissions and make it executable.

Code:
sudo chmod +x /etc/cron.weekly/backup
sudo chmod 755 /etc/cron.weekly/backup

You could also add your databases to the weekly backup by adding this to the backup cron:

Code:
mysqldump -u [username] –p[password with no space, so it will start with -p] [database_name] > /folder/to/save/[dump_file.sql]

For cron to work you will need to edit crontab.

To do this run:

Code:
nano /etc/crontab

Code:
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root HOME=/
# run-parts
01 * * * * root run-parts /etc/cron.hourly
15 4 * * * root run-parts /etc/cron.daily
30 8 * * 0 root run-parts /etc/cron.weekly
45 12 1 * * root run-parts /etc/cron.monthly

Crontab – Quick Reference

Code:
sudo chmod +x /etc/crontab
sudo chmod 755 /etc/crontab

Code:
service crond restart

Code:
chkconfig crond on

To setup the server to do automatic updates run:

Code:
yum -y install yum-cron

Code:
nano /etc/yum.conf

Add this to the file:

Code:
exclude=kernel* mysql*

This will pervent MySQL and the kernel from updating.

Next add your email to:

Code:
nano /etc/sysconfig/yum-cron

look for MAILTO=

Next start the service:

Code:
chkconfig yum-cron on
service yum-cron start

Lastly do some clean up

Code:
yum clean all

Now just reboot the server. Once rebooted log into sentora by entering the server IP into a web browser. You should of copied the login details earlier when the sentora script finished running.

To see if you are getting the speeds your VPS providers advertise run:

Code:
ethtool eth0 | grep -i speed

This will tell you what connection you have.

You can run these command to install Speedtest.net. Doing this isn't an accurate test. There's too many variables in play for it to be accurate. But it will give you a rough idea of what speeds you are getting.

Code:
wget -O speedtest-cli.py https://github.com/sivel/speedtest-cli/raw/master/speedtest_cli.py
chmod a+rx speedtest-cli.py
sudo mv speedtest-cli.py /usr/local/bin/speedtest
sudo chown root:root /usr/local/bin/speedtest
speedtest

To upgrade to PHP version 5.5 run:

Code:
rpm -Uvh http://mirror.webtatic.com/yum/el6/latest.rpm

Code:
yum install yum-plugin-replace
yum replace php-common --replace-with=php55w-common

Doing this will break suhosin and XCache.

To repair run:

Suhosin:
Code:
wget https://github.com/stefanesser/suhosin/archive/master.zip
unzip master.zip
cd suhosin-master
phpize
./configure
make
make install
echo 'extension=suhosin.so' > /etc/php.d/suhosin.ini
echo 'suhosin.executor.include.whitelist = upload://' > /etc/php.d/suhosin.ini

XCache:
Code:
wget http://xcache.lighttpd.net/pub/Releases/3.1.0/xcache-3.1.0.tar.gz
tar xvfz xcache-3.1.0.tar.gz
cd xcache-3.1.0
phpize
./configure --enable-xcache
make
make install

Then add this to php.ini

Code:
nano /etc/php.ini

Code:
[xcache-common]
zend_extension = /usr/lib64/php/modules/xcache.so
extension=xcache.so
[xcache]
; Change xcache.size to tune the size of the opcode cache
xcache.size         = 24M
xcache.shm_scheme   = "mmap"
xcache.count        = 2
xcache.slots        = 8K
xcache.ttl          = 0
xcache.gc_interval  = 0

; Change xcache.var_size to adjust the size of variable cache
xcache.var_size     = 8M
xcache.var_count    = 1
xcache.var_slots    = 8K
xcache.var_ttl      = 0
xcache.var_maxttl   = 0
xcache.var_gc_interval =     300
xcache.test         = Off
xcache.readonly_protection = On
xcache.mmap_path    = "/tmp/xcache"
xcache.coredump_directory =   ""
xcache.cacher       = On
xcache.stat         = On
xcache.optimizer    = Off

[xcache.coverager]
xcache.coverager    = On
xcache.coveragedump_directory = ""

Code:
service httpd restart
Reply
Thanks given by: Ron-e
#2
RE: Full VPS Setup on CentOS
CentOS 7 running MariaDB instead of MySQL on CentOS 6.
To my knowledge MariaDB is a drop-in replacement for MySQL, but i know that there are some differences.
So my question is, did you test this on MySQL and MariaDB both?

My Sentora DemoMy GithubAuxio Github
Zentora themeS-Type themeCstyleX theme
flat-color-iconssmall-n-flat-icons

Sentora's development takes way too long, so i'm transitioning to HestiaCP.
Reply
Thanks given by:
#3
RE: Full VPS Setup on CentOS
(11-08-2015, 04:47 AM)Ron-e Wrote: CentOS 7 running MariaDB instead of MySQL on CentOS 6.
To my knowledge MariaDB is a drop-in replacement for MySQL, but i know that there are some differences.
So my question is, did you test this on MySQL and MariaDB both?

I tested this on CentOS 6.4

But the settings (as I am aware) should be the same for MariaDB as it is for MySQL.
As you said MariaDB is a drop in replacement and it should use all the same settings/config files as MySQL.

MariaDB is similar in away to Sentora. Its a fork but all the commands and settings are the same as the former project.
Reply
Thanks given by:


Possibly Related Threads…
Thread Author Replies Views Last Post
Fail2ban for Sentora (Centos 7) bbspike 14 44 ,501 01-14-2020, 07:32 AM
Last Post: Vedran B
[How To] Update from PHP v5.4.16 to v5.6.31 (Includes suhosin patch) [CentOS] betatester3.0 5 16 ,804 03-18-2019, 01:23 AM
Last Post: BigBang
Ubuntu: How to setup TLS on postfix and dovecot Diablo925 28 107 ,166 02-15-2018, 08:46 PM
Last Post: duane

Forum Jump:


Users browsing this thread: 1 Guest(s)