Pages

Showing posts with label rackspace. Show all posts
Showing posts with label rackspace. Show all posts

Installing mybb on rackspace cloud server


In previous post I wrote how to get started with rackspace cloud server, and installed nginx, postgres, php and exim4. in this post I'll demonstrate how to install mybb forum script on cloud server.
Requirements:
  1. Cloud server
  2. webserver (nginx), postgres, mail trasfere agent (exim4) and php5 cgi
  3. Latest mybb forum script
  4. sftp client

  1. Signing up with rackspace cloud server

    if you haven't signed up at rackspace cloud yet, continuing reading is more likely to be as a boring lecture :). sure you can continue or  sign up now
  2. Installing webserver (nginx), postgres, mail trasfere agent (exim4) and php5 cgi

    Installing nginx, postgresql, exim4 and php5 cgi is covered in previous post, please refer it
  3. Downloading the latest mybb forum script

    first get the latest version of mybb from http://www.mybb.com/download/latest extract it and rename folder Upload to web
  4. Uploading mybb using sftp client

    Here you can use any sftp client either command line such as sftp on linux/ psftp on windows(part of putty tools), or GUI many are available check the one that support sftp not ftps, ftps you don't need it here. for this demo I'll use sftp command line client, remember that our goal is to upload mybb files to a place where nginx is able to reach .so basically all mybb files MUST located in /home/naoar/web so that /home/naoar/web/index.php is the location of mybb forum index file
    login to your cloud server

    enter your password not root password
    then upload the local directory web to /home/naoar
    uploading will start :)
    once uploading finished, you can make sure everything is in its place:

    if no errors found, we can safely close the sftp client and go to install mybb from a web browser, the rest of this post is demo images, installation process quite simple, just fill and go :)

----------------
you may also like to install a plugin I wrote which itsNaoar Donation plugin for mybb once you finished
cheers














Installing nginx postgresql php and exim 4 on rackspace cloud server


today I'm writng simple how-to start with your rackspace cloud server. I'll try to put things together as much as possible, I consider this setup is simple, beacuse it is involve only one server for all your needs, advanced setup involve multiple servers working as a team. You may know that cloud server comes with minimal operating system installled, so no webserver no database and no php, this is how awsome is cloud server giving you full control of what you need to install, ok basically we'll do the followng:

NOTE: whereever you see xxx.xxx.xxx.xxx replace it with your cloud server ip address


NOTICE: You need SSH client, terminal in linux and mac, putty in windows

  1. Signing up with rackspace cloud(if not yet)
  2. Create a cloud server(256 Mb RAM = smallest, you may choose bigger one if you like)
  3. Basic configuration and security
  4. Install webserver(nginx)
  5. Install database(postgresql)
  6. install php5 cgi, related extensions
  7. Install exim4(mail transfer agent) and configure it


  1. Signing up with rackspace cloud:



    if you don't have a cloud server yet, you may head to rackspace and get one now, or continue reading :)
    signing up is easy and you may get your server up and running in less than 15 minute.

  2. Create a cloud server:



    There is no hard rule for choosing your server distribution, rackspace cloud servers are available in many operating systems, as long you don't choose windows your are in safe side :) . please choose the distribution you are the most familiar with, if you know arch linux go for arch, if you are ubuntu guy go for ubuntu.. and so on. I don't suggest any distribution
    All distribution are goods, so you better choose what you know, and there is not too much difference between them, however if you are really newbie , then I've a warning for you: don't choose GENTOO, its for advanced linux users, I recommend you install any of the others on your computer, read online tutorials..and manuals if available. to know your server more.
    For this tutorial I'll choose debian 6 sequeeze and 256 MB RAM server, which comes with 10 Gb disk space

    Available server sizes:
    Tip: when you need a software you are advised firstly to search your operating system repository if it containes the software you want, and ONLY compile a software if its not found there and no other alternatives doing its job, if you choosed Ubuntu the following commands are almost similar in your system and they may work, if you choosed Centos or redhat you need to use yum command rather than apt-get, you cannot most of the time know the full name of the software you want to know, for a reason repositories usually add version number to the name of your software, for example postgresql is named in debian repositories as postgresql-8.4, postgreslq-9.1 so do search 1st to locate your software, then install,

  3. Basic configuration and security

    1st thing you need to login to your cloud server:


    then enter your root password

    you need to change hostname of the server to match your website domain, for example if you bought a domain example.com you need to set the hostname of the server to example.com so run the following:


    then edit the entry to hosts file:


    add example.com after localhost in the same line, so it should look like:


    save and quit hosts file

    now reboot your machine, run the following command


    you need to wait some seconds before trying to login again.


    and enter your password


    next you need to change the root password(optional, recommended)


    enter your new password

    add new user to use it instead of root accout(optional, recommended)


    then enter user password

    then add user naoar to sudoers so can gain root privilage when needed to do so run the folowing command:


    inside the file add:


    in its own line and just after:

    then close the file CTRL+X

    for more info about suders format run man sudoers

    next we need to update the system software, so run the following:


    ------------
    ok now you get your system updated.. lets enhance server security a bit :
    run the followng command to see who is currently connected to your server


    it should be only you,

    we'll disable root login via ssh so go and edit sshd_config




    save and exit

    next add a firewall :)
    here we'll open the needed port, and close everything else :)
    we'll open the following ports:
    80 :WWW
    443: SSL
    25: Mail
    22: ssh
    53: dns

    and close others

    so run the following for ipv4:
    create a firewall file with all rules inside it

    and paste the following inside it

    save and exit CTRL+x

    now create a firewall for ipv6


    and paste the following in it:

    now testing our rules:

    if you don't loose connection to your server then its likely to be ok.

    try pining your server from your local computer/labtop:


    if you didn't get any resonse, then firewall is working so we need to keep these rules even after rebooting your cloud server:


    now firewall rules can be persist after reboot

    these are basic steps to secure your cloud server ,probably you want to harden your server security more..
  4. Install webserver(nginx)

    to install nginx run the following command


    decide where you'd like to put your web application(drupal for example), lets make directory:

    and tell nginx to look there for requested pages, so open nginx.conf

    and mak sure any root word look like:

    and php block like this

    NOTE: I suggest you install signed ssl certificate on your server and only use https when you perform an adminstrative tasks on your website.
  5. Install database server(postgresql)

    to install postgresql run the following command


    if you would like to install latest stable postgresql 9.1
    you need to add backports source to your sources.list, so run the following


    if you got some unsolved dependecies try aptitude, it'll try to help you solve unmet dependencies
    next we need to create new database

    you're now logged as postgres user, so we want to create database named mydb:

    create a naoar user and the password 123456

    grant all privilege to naoar

    ok database is ready now
  6. install php5 cgi, related extensions


    to install php5 and some recommended extensions:

    this will install php 5.3.x, postgreql extension to connect to your postgresql server, image library gd and xcache

    you may find that php5-cgi binary crashes frequently, this is not nice when your website is up and running, your users may get 502 Bad gateway error, in order to prevent that we need to restart php5-cgi whenever it crashes, so run the following:


  7. Install exim4(mail transfer agent)


    to install exim4 run the following

    this will install light binary, suffeciant for sending emails from your cloud server

    you can reconfigure exim4 at anytime just run













    test if sending email is working


    if you didn't get errors, and you recieved the email, then things seems ok

    this email setup will let you send emails from your cloud to your website members, please note that recieving emails will you require you setup spamassin and many other stuff, defintlly you can accept incoming mails with changing the settings of exim4, but I would not recommend it, better you use other free services which can act as mail server for your incoming emails and will let you access your email from any email client imap or pop3, for this you may try google ad-supported for business or try ads-free email hosting from rackspace which is for only 2$/month




ok now reboot your cloud server

and that was the last time you login as root :), from now on you need to connect using your new username 'naoar' and raise your privilage WHEN NEEDED using sudo
so to login again


enter your password
for exaample you want to see listeneing tcp and udp servers


enter naoar password not root passwd

------------------------------------------

ok so far your server is
-capable of sending emails
-ready to serve static files, html and php (via php5-cgi), through port 80
-ready to install postgresql-driven php web applications :)

NOTE: you need to login to your dns provider and change the Address record commonly named A record (Host) to point to your cloud server ip address so that from now on you can access your cloud server using your domain


so whats next?: install web application, for example mybb forum script click here to know how


------------
cheers

Rackspace my favorite cloud hosting provider


In this post I will expain reasons of why I choosed Rackspace as my fvorite cloud hosting provider, actually I was on AWS(Amazon web Services) but I left them :)

My boring story at AWS:
went away because the charged me 0.21 USD, yeah this was so small amount, right?!! well this is not the point, just look at the timing they charged me 0.21 USD while I supposed to be testing within the free limits they offered, it was the smallest instance(tiny) EC2 available there, they put free limits to use, if you exceeded the free limits you will be charged. so basically they claimed(I don't thnk they were lying though) I exceeded the free limits, ok come on I were testing only :P. the only thing I remembered before I being charged again 0.21 USD :) was updating my software instance. I ran Amazon Linux 32bit (BETA): which is a Red had based distribution, and after updating finished, the instance hanged with no respose, maybe it was a network problem, or the server problem I didn't know.. however after some days I saw that I had to pay 0.21 USD the REASON because I used more than 1 milion i/o of elastic block storage.. imagine that was before I uploading my application or even  before getting an elastic ip address. I paid for them and left them, fare enough.

after that story, for me anything other than AWS would be better, :P. this was my a feeling.. but still I want to try cloud hosting, after some googling found:

Cloud Hosting in the Market:

Amazon AWS(Amazon Web services).
Godaaddy(new in the market)
Gogrid
Rackspace
Softlayer
.. and many others

From all the cloud hosting providers, I couldn't find a reputable, specialized and professional company that support open source technology other than rackspace. this is a fact: see later, while other may claim amazon is good too, well I respect amazon as a company, but also believe that sometimes to be specialized at something better than invest in everything and not specialized in one thing. however if we want to compare these cloud hosting providers based on company size (probably there is other things to consider rather than company size), we can take amazon, godaddy and rackspace, you can see that even godaddy compare these three companies.. will I like to compare them myself, thanks godaddy :)

-----------

AWS:

-Pros:
- reputable
- wide range of servers configurations and distributions.
- Large block storage can be added to your server.
- API access is available.
- Database service available.

-Cons:
- costy compared to the others especially on small servers
- more complex setup: you need to setup an instance, add storage and add elastic ipaddress
- data in the instance is not persistant, you may lose your files if they are not stored in elastic block storage, storing it in elastc block storage will be an advantagous for amazon though but not you :) you'll be charged per 1 million i/o operations, do not think that 1 million i/o is too much.. just try using it and add your comment below.
- Not an easy api to play with
- No humans to talk with: support is availabe at extra charge.
- Complex pricing: pay for server, 1 million i/o of elastic block storage, traffic and elastic ipaddress (if not in use)
- Not open source based.

Godaddy:

-Pros:
- reputable?!
- servers are behind firewall(disatvantage?)
- lowest price
- large servers RAM are available

-Cons:
- No api access
- No database service.
- still new in the market, so unprofessional faults are expected.
- Not specialized in cloud hosting.


Rackspace:

-Pros:
- reputable
- Easy API access
- Large servers are availabe
- You can mix dedicated servers and cloud servers to get advanced setups
- CDN file hosting available
- Free 40,000 Emais to send every month :), this is other than you can send emails from your cloud server.
- Fast and responsive servers.
- Great support
- Simple pricing.
- Database service is available.
- Datacenter available in UK and USA.
- Based on open source cloud technology.

-Cons:
- No storage can be added to cloud servers, so the cloud server in this ascpect is similar to dedicated server in terms of pre-configured setup, however if you want to add storage, you can resize your server to larger one without losing your data(adding storage to cloud server is in development).



I know reputation is not something you can rely on when choosing a web hosting, many may spread untrue stories about certain company for personal reasons, but reputation can be added to the other factors for example (available configurations, price, support).

In web hosting terms a good support is a MUST to succeed in your business, and you cannot give good support if you are not specialist. Here it comes rackspace.

why to chose racksace:

lets take a quick and closer look here, Rackspace offers many products:
Dedicated servers: Fully managed dedicated servers
Email hosting: Managed email hosting for your domains
.. etc
----

cloud products:

- Cloud sites: fully managed  cloud hostings, you can host unlimited websites on windows and linux or both at the same time, and this is not the same as shared hosting all we know about, no downtime is expected and when your website need more resources, it will be given more, About pricing you pay for traffic, disk space and computer cycle.
- Cloud Files: unlimited file storage, not like shared-hosting companies which they claim you'll get unlimited disk space, but when you store some gigabyte the suspend your account, cloud files is truley unlimited, you can use to store static files, or to store your backups, cloud files  stores your files privately moreover is CDN ready service, only pay per Gigabyte storage and traffic.
- Cloud servers: different flavors, fully configurable servers no pre-installed unneeded applications other than your minimal operating system programs, windows and linux are available, you can install virtually anything on these servers from forum script to mail server.
-cloud databases: fast and reliable mysql database service you can use, instead of putting your application and database on the same server, you can just use this service, forget about managing databases issues, and give your application more horse-power

and many others..

please note that cloud sites, cloud servers, cloud databases and cloud files are registered trade marks for Rackspace.

ok since I'm web dev, I got attracted to three products cloud servers, cloud files and cloud databases. these are a great tools in the right hands :)



------------
cheers