How-To: Install VPS (HyperVM)
Hi guys, its been a while since I’ve posted anything to this blog. Since I’ve switched to linux I don’t program much for windows any more. But I will still try to update software I’ve released, like ComiX which is gotten more popular then I thought. I will also be bloging about my linux and computer experiences on here as well.
Here is a quick how-to from my notes, ones I’ve installed my vps;
VPS Specs Used:
OS: CentOS 5.3
Web Server: LightTPD
FTP Server: vsFTPd
MySQL Server and PHP
WordPress Blog
First we use to HyperVM to install CentOS 5, ones its done go to your linux shell and type the following to login.
1 2 | ssh root@yourdomain.com password: YOUR_PASSWORD (ones asked) |
## Disable SELinux and Firewall:
1 | system-config-securitylevel-tui |
(which is optional of course).
## Stop and Remove Apache (HTTPD) Web Server
1 | service httpd stop && yum -y remove httpd |
## Install RPMForge Repository for CentOS
## URL: https://rpmrepo.org/RPMforge/Using
1 2 | wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.3.6-1.el5.rf.i386.rpm rpm -Uhv rpmforge-release-0.3.6-1.el5.rf.i386.rpm |
## Upgrade CentOS to 5.3 and install nano,zip,rar,unrar
1 | yum -y update && yum -y install nano zip rar unrar |
(at this point you can install other packages if you need).
## Disable .bash_history (optional).
1 | rm -f .bash_history && touch .bash_history && chmod 000 .bash_history && ln -sf /dev/null .bash_history |
## Disable lastlog (optional).
1 | cd /var/log/ && rm -f lastlog && touch lastlog && chmod 000 lastlog && ln -sf /dev/null lastlog && cd |
## Disable .mysql_history (optional).
1 | rm -f .mysql_history && touch .mysql_history && chmod 000 .mysql_history && ln -sf /dev/null .mysql_history |
## Install MySQL 5 Database Server
1 | yum -y install mysql mysql-server && chkconfig --levels 235 mysqld on && service mysqld start |
## Set root and hostname passwords
1 2 | mysqladmin -u root password 'new_pass_here' mysqladmin -h server.yourdomain.com -u root password 'new_pass_here' |
## Create mysql user for WordPress (optional)
1 2 3 4 | mysql -u root -p (pass when prompted) create database your_blog; (chose your own database) grant all on your_blog.* to your_user@localhost identified by 'pass_here'; exit |
## Install LightTPD Web Server
1 | yum -y install lighttpd && chkconfig --levels 235 lighttpd on && service lighttpd start |
## Configure LightTPD
## Backup lighttpd.conf file
1 | cp -r /etc/lighttpd/lighttpd.conf /etc/lighttpd/lighttpd.conf_bak |
## Empty lighttpd.conf file
1 | echo "" > /etc/lighttpd/lighttpd.conf |
## Copy & Paste this config file
1 | nano /etc/lighttpd/lighttpd.conf |
ctrl+o (save file), ctrl+x (exit)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 | ## ## Custom LightTPD Config File ## ## modules to load: server.modules = ( "mod_fastcgi", "mod_cgi", "mod_redirect", "mod_access", "mod_accesslog" ) ## server root directory: server.document-root = "/srv/www/" ## mimetype mapping: mimetype.assign = ( ".rpm" => "application/x-rpm", ".pdf" => "application/pdf", ".sig" => "application/pgp-signature", ".class" => "application/octet-stream", ".gz" => "application/x-gzip", ".swf" => "application/x-shockwave-flash", ".tar.gz" => "application/x-tgz", ".tgz" => "application/x-tgz", ".tar" => "application/x-tar", ".zip" => "application/zip", ".mp3" => "audio/mpeg", ".m3u" => "audio/x-mpegurl", ".wma" => "audio/x-ms-wma", ".wax" => "audio/x-ms-wax", ".ogg" => "application/ogg", ".wav" => "audio/x-wav", ".gif" => "image/gif", ".jar" => "application/x-java-archive", ".jpg" => "image/jpeg", ".jpeg" => "image/jpeg", ".png" => "image/png", ".css" => "text/css", ".html" => "text/html", ".htm" => "text/html", ".js" => "text/javascript", ".asc" => "text/plain", ".c" => "text/plain", ".cpp" => "text/plain", ".log" => "text/plain", ".conf" => "text/plain", ".text" => "text/plain", ".txt" => "text/plain", ".dtd" => "text/xml", ".xml" => "text/xml", ".mpeg" => "video/mpeg", ".mpg" => "video/mpeg", ".mov" => "video/quicktime", ".qt" => "video/quicktime", ".avi" => "video/x-msvideo", ".asf" => "video/x-ms-asf", ".asx" => "video/x-ms-asf", ".wmv" => "video/x-ms-wmv", ".bz2" => "application/x-bzip", ".tbz" => "application/x-bzip-compressed-tar", ".tar.bz2" => "application/x-bzip-compressed-tar", "" => "application/octet-stream", ) ## index files: index-file.names = ( "index.html", "index.php" ) ## send a different server header: server.tag = "LightTPD" ## where to log errors: server.errorlog = "/var/log/lighttpd/error.log" ## where to log access: accesslog.filename = "/var/log/lighttpd/access.log" ## deny access to file-extensions: url.access-deny = ( "~", ".inc" ) $HTTP["url"] =~ ".pdf$" { server.range-requests = "disable" } ## ignore extensions via static-file transfer: static-file.exclude-extensions = ( ".php", ".pl", ".fcgi", ".cgi" ) ## help the rc.scripts server.pid-file = "/var/run/lighttpd.pid" ## change uid username: server.username = "lighttpd" ## change uid group: server.groupname = "lighttpd" ## fastcgi module: fastcgi.server = ( ".php" => ( "localhost" => ( "socket" => "/tmp/php-fastcgi.socket", "bin-path" => "/usr/bin/php-cgi" ) ) ) ## cgi support: cgi.assign = ( ".pl" => "/usr/bin/perl", ".cgi" => "/usr/bin/perl" ) ## make wordpress urls clean: server.error-handler-404 = "/index.php?error=404" ## www to non-www urls $HTTP["host"] =~ "^www.(.*)" { url.redirect = ( "^/(.*)" => "http://%1/$1" ) } |
## Install PHP5 and modules
## Install LightTPD CGI/PHP modules
1 | yum -y install lighttpd-fastcgi php-cli |
## Configure php.ini file
1 | nano /etc/php.ini |
(add the following line to the end of php.ini)
1 | cgi.fix_pathinfo = 1 |
## Install aditional php modules
1 | yum -y install php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc |
## Restart LightTPD server
1 | service lighttpd restart |
## Delete LightTPD folder (optional)
1 2 | cd /srv/www/ rm -rf lighttpd/ |
## Install vsFTPd Server
1 | yum -y install vsftpd && chkconfig --levels 235 vsftpd on && service vsftpd start |
## Add vsFTPd user
1 2 3 | useradd -G users,ftp,wheel user_name_here -s /sbin/nologin passwd user_name_here chown -R user_name_here /srv/www/ |



