Initial Setup?

Hi everybody, I'm evaluating linode against openhosting.com and so far, linode has been much more difficult to set up. The biggest problem is that I can't seem to get my choice of distro right (I know… it's a feature, but I guess I suck at linux more than I thought).

I have a lot of experience using linux, but almost none maintaining it (I have a mac).

Here's what I'd like

1) a simple package installer, like yum

2) a default, secure apache2, php5, mysql install

3) a normal user account (not root)

I've tried installing CentOS and now Ubuntu LTS 8.something… it's on the bottom-left when you pick one

Ok, I can kind of set up #3 with useradd, but it didn't create a home folder! Then, if I create it manually, it doesn't use bash when it first logs in… I don't know what it's supposed to have in it by default :)

Shouldn't #2 already be installed? If so, how do you start it? I thought I would have an apachectl or httpd command in my path, but no luck (excuse newbieness again, I'm used to control panels)

And I can't figure out the package installer for the life of me. I thought it was supposed to be installed automatically.

Several people have mentioned ubuntu as a good choice for new users, but maybe I picked the wrong one or something?

Thanks!

20 Replies

CentOS is easy to set up if you ask me, you'll have Yum anyway.

When I created an account using useradd I did create a /home/ for me, but could be that you'll need an extra switch.

Apache2, PHP5, MySQL and stuff you can easily install with yum. Once installed you can use 'service httpd start' (it should auto-start after install), php5 will be loaded if everything went correctly. And MySQL should start as well.

I used this on my clean install of CentOS :

rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY*
yum update && yum upgrade
yum install fetchmail wget bzip2 unzip zip nmap openssl lynx fileutils ncftp gcc gcc-c++
yum install mysql mysql-devel mysql-server
chkconfig --levels 235 mysqld on
/etc/init.d/mysqld start

mysqladmin -u root password <your new="" password="">yum install php php-devel php-gd php-imap php-ldap php-mysql php-odbc php-pear php-xml php-xmlrpc curl curl-devel perl-libwww-perl ImageMagick libxml2 libxml2-devel mod_ssl php_mcrypt php_mbstring

chkconfig --levels 235 httpd on

service httpd start</your> 

That should just about install anything you need, also it's based of this guide : http://www.howtoforge.com/perfect-server-centos-5.2. You can skip the things you don't want / need. But php, mysql and apache is explained. Proftpd as well in case you don't want Vsftpd (the default Centos ftp server)

1) In Debian/Ubuntu, you use apt-get to install packages.

apt-get install apache2 libapache2-mod-php5 php5 mysql-server mysql-client

should give you a barebone LAMP stack, though you probably want other PHP features as well. Just look up the package name and apt-get install whatever you need. In case of Ubuntu, installing those packages automatically starts the corresponding services.

2) As said above, you need to install the webserver and PHP yourself. There are people here who wouldn't like it if the webserver were already installed, as some of us use our linodes for something other than webservers. Others prefer lighttpd or nginx to apache2, or ruby on rails or python/django to PHP. So the default install only comes with a barebones system.

For your information, on Ubuntu, you can manually start/restart/stop Apache2 by issuing the command:

/etc/init.d/apache2 start (restart, stop, whatever)

The same pattern goes for most other kinds of services.

Apache2 configuration is in /etc/apache2/apache2.conf

3) useradd doesn't create a home folder for you. You need to do

mkdir /path/to/home/folder
chown username:groupname /path/to/home/folder
usermod -d /path/to/home/folder username

or, if you want a simpler solution, you can use adduser instead of useradd. It sets up everything for you. And if you want to manage your server with a non-root account, you'd better run visudo and add your username to the list.

If you want bash, edit /etc/passwd and find your username, and replace the part that says /bin/sh to /bin/bash

You guys are awesome! Thanks!

One more question. I'm only planning on owning one VPS. I haven't looked into what the best rails production environment is, but I want to use it to host a (hopefully) medium-traffic rails app. Can I run apache at the same time, or would that use too much ram / cpu?

So, ideally, I would have apache hosting some basic files, maybe wordpress and a low-traffic forum, and then have one or two rails apps (on different domains, of course).

Is that going to be a problem? Is there any particularly way I need set up apache? (I'm going to do the rails thing later)

Thanks again!

@hybinet:

if you want a simpler solution, you can use adduser instead of useradd. It sets up everything for you. And if you want to manage your server with a non-root account, you'd better run visudo and add your username to the list.

Lol, I always use adduser instead of useradd.. That's probably why I always get a /home made :)

Oh btw, I've got some sites running on my Linode 360 and I've tried running Free NX server (remote desktop app with Gnome) it all ran well enough. (Just for the kick ;)) Still only using around 180 mb. Apache2, MySQL and php all in default settings. My sites aren't that much visited, so it could vary. But still, it should suffice. I haven't got much experience with rails so I dunno about that. But my java app ran well on my 360. Even so, you can upgrade very easy via the Linode Manager with only extra ram. Only keep in mind, it's cheaper eventually to just upgrade to a bigger Linode ^^

Ruby on Rails normally goes hand-in-hand with lighttpd rather than apache. If you want RoR with apache, you'll need to make a few tweaks involving FastCGI. Here seems to be a nice tutorial:

http://www.howtoforge.com/rubyonrailsdebianetch

It says it's for Debian, but the same should work for Ubuntu.

Or you might ditch apache altogether and use lighttpd for all of your sites. It's fast and takes up very little ram, but it's a little more tricky to configure than apache. lighttpd also has a tiny problem with Wordpress permalinks (pretty URL's), though it's not impossible to solve.

Of course you can use both apache and lighttpd and try both, but that takes a bit more tweaking. Google is your friend here.

Just try a few different configurations, and see how much cpu/ram you're using. A linode 360 can go pretty far in fact; if you outgrow it, you can easily upgrade. htop is a nice tool that lets you monitor cpu/ram usage in real time.

Great info everybody, thanks

@hybinet … what about apache proxying mongrel instances? Would that play together more nicely? I suppose I could learn lighthttpd, but I'm so used to apache's conf files (virtual hosts) I'd hate to learn another.

I ran into an awesome article on how to deploy a rails app, but I lost the link. Think seem to change so quickly, it's hard to know what the best option is.

Thanks for all the info!

Apologies to Linode but I found the set-up tutorials on Slicehost to be about the easiest and best-written ones to follow:

Main article list:

http://articles.slicehost.com/sitemap

Particularly useful for a Ubuntu setup:

Ubuntu Hardy setup - page 1

http://articles.slicehost.com/2008/4/25 … tup-page-1">http://articles.slicehost.com/2008/4/25/ubuntu-hardy-setup-page-1

PickledOnion is probably their main asset :wink:

@hybinet:

Ruby on Rails normally goes hand-in-hand with lighttpd rather than apache. If you want RoR with apache, you'll need to make a few tweaks involving FastCGI. Here seems to be a nice tutorial:

http://www.howtoforge.com/rubyonrailsdebianetch

It says it's for Debian, but the same should work for Ubuntu.

Or you might ditch apache altogether and use lighttpd for all of your sites. It's fast and takes up very little ram, but it's a little more tricky to configure than apache. lighttpd also has a tiny problem with Wordpress permalinks (pretty URL's), though it's not impossible to solve.

Of course you can use both apache and lighttpd and try both, but that takes a bit more tweaking. Google is your friend here.

Just try a few different configurations, and see how much cpu/ram you're using. A linode 360 can go pretty far in fact; if you outgrow it, you can easily upgrade. htop is a nice tool that lets you monitor cpu/ram usage in real time.

Ok I'm sorry but anyone who is saying that if you use apache look into FastCGI is not a person to be taking rails advice from. There is nothing wrong with using apache for rails, but if you use modproxybalancer be aware that it is only capable of 150 req/sec or so.

TBH the best rails setup is probably nginx + mongrel cluster with nginx serving static and proxying to the mongrels, be sure to use the fair module in the proxy as it helps by not trying to send requests to stuck mongrels until they are finished their current request.

Slicehost does have some good articles, but linode has better server specs for their users, more RAM and HDD per $.

Linode is the go.

@MrNod:

Apologies to Linode but I found the set-up tutorials on Slicehost to be about the easiest and best-written ones to follow:

Main article list:

http://articles.slicehost.com/sitemap

Particularly useful for a Ubuntu setup:

Ubuntu Hardy setup - page 1

http://articles.slicehost.com/2008/4/25 … tup-page-1">http://articles.slicehost.com/2008/4/25/ubuntu-hardy-setup-page-1

PickledOnion is probably their main asset :wink:

Linode has a wiki for community-contributed documentation, and personally I would rather they keep churning out good products and an excellent service then redundant documentation (like how to configure apache), which can be found with ease elsewhere.

> Ok I'm sorry but anyone who is saying that if you use apache look into FastCGI is not a person to be taking rails advice from. There is nothing wrong with using apache for rails, but if you use modproxybalancer be aware that it is only capable of 150 req/sec or so.

Hehe… Yeah, I know that FastCGI is a dirty word in the rails community. Thanks for your suggestion, I'll google it.

What about mod_rails? Anybody actually use it?

It's not horrible, but it is not necessarily the best either. If you are going to use apache it's not a bad idea as you cut out the main bottleneck, modproxybalancer, but if you are running on a VPS with low RAM then run a cluster of mongrels behind nginx.

Debian, and by association Ubuntu, do not like rails very much. From what I see you may have some difficulties down the road. That said, I think Ubuntu is the best distro going. I was going to explore rails but when I learned about the difficulties, I gave it up.

Jim.

@AverageGuy:

Debian, and by association Ubuntu, do not like rails very much. From what I see you may have some difficulties down the road. That said, I think Ubuntu is the best distro going. I was going to explore rails but when I learned about the difficulties, I gave it up.

Jim.

Do you have any details to what these difficulties may be? I am a rails developer and was thinking that my app I have in development would be going onto Ubuntu, so if you have any info/links to this information I would love to have it before I run my first deployment.

Do you have any details to what these difficulties may be? I am a rails developer and was thinking that my app I have in development would be going onto Ubuntu, so if you have any info/links to this information I would love to have it before I run my first deployment.

Here are two references:

http://wiki.rubyonrails.org/rails/pages/RailsOnUbuntu

The url does a good job of describing it. ;)

http://pkg-ruby-extras.alioth.debian.org/rubygems.html

That is Debian's position on using Ruby Gems.

Enjoy,

Jim

I don't think that either of these links provide reasons not to use Ubuntu, it is more telling you how to install it a few different ways and what to expect with each way you install it.

For most servers, once you have them up and running, there are very few reasons to upgrade as you don't want to break a production environment that doesn't need fixing, so a production environment in Ubuntu shouldn't really be a problem.

I think that you should be a little more careful with comments, as saying baseless things like this could scare a noob away from using something that is fine to use and making their experience more difficult than it has to be.

@cherring:

I don't think that either of these links provide reasons not to use Ubuntu, it is more telling you how to install it a few different ways and what to expect with each way you install it.

For most servers, once you have them up and running, there are very few reasons to upgrade as you don't want to break a production environment that doesn't need fixing, so a production environment in Ubuntu shouldn't really be a problem.

I think that you should be a little more careful with comments, as saying baseless things like this could scare a noob away from using something that is fine to use and making their experience more difficult than it has to be.

I was simply expressing my opinion that there are valid reasons as stated in Debian's Position that it can present one with difficulties down the road. As I said I elected to avoid the problems by not using ruby on rails. I for one would not be happy if someone didn't point that out and I was left with an un-upgradable system or at the very least one that might be somewhat more difficult to upgrade.

Sorry you think I'm badmouthing Ubuntu, in fact my intent was more to warn people away from Ruby on Rails because I believe its Ruby Gems to be a poor idea. I like Ubuntu and encourage anyone to use it. I don't want people to blindly implement a distro that might give them grief down the road. That's a sure fire way to get people to really badmouth a distro.

Jim

My point was that if you make wild statements, some people will take it as gosbel when they really shouldn't. The only thing you really need to do to have a perfectly upgradeable system is install gems from source, ruby and your server via packages and you are set to go, both are easily upgradable, system via apt and ruby gems via the built in installer, but to be honest once they are set up right upgrading production systems should be minimal where it can be avoided to keep stability high.

Just one question, if this scared you off rails what did you decide to use instead?

@cherring:

My point was that if you make wild statements, some people will take it as gosbel when they really shouldn't. The only thing you really need to do to have a perfectly upgradeable system is install gems from source, ruby and your server via packages and you are set to go, both are easily upgradable, system via apt and ruby gems via the built in installer, but to be honest once they are set up right upgrading production systems should be minimal where it can be avoided to keep stability high.

Just one question, if this scared you off rails what did you decide to use instead?

I didn't. I wanted to run an app that used it but decided the hassle was too great, so I didn't use that app. I'm not a big fan of Ruby on Rails as can tell.

Thanks,

Jim.

That's cool, you don't have to like Rails, I was just curious.

@Navi:

rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY*
yum update && yum upgrade
yum install fetchmail wget bzip2 unzip zip nmap openssl lynx fileutils ncftp gcc gcc-c++
yum install mysql mysql-devel mysql-server
chkconfig --levels 235 mysqld on
/etc/init.d/mysqld start

mysqladmin -u root password <your new="" password="">yum install php php-devel php-gd php-imap php-ldap php-mysql php-odbc php-pear php-xml php-xmlrpc curl curl-devel perl-libwww-perl ImageMagick libxml2 libxml2-devel mod_ssl php_mcrypt php_mbstring

chkconfig --levels 235 httpd on

service httpd start</your> 

Hi Navi,

What you'd outline here is very useful. I followed every step you mentioned and got my website working. Thanks!

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct