Archive

Posts Tagged ‘Linux’

Errors using Capistrano

April 28th, 2010

“** [out :: myserver] deploy is not in the sudoers file.  This incident will be reported.”  — Solution is here.

Read more…

Andrew Development , , , , ,

Configure Apache with a Server Alias

March 10th, 2010

Notes on setting up apache for multiple web sites:

In the /etc/apache2 directory you have two directories:
- sites-available
- sites-enabled

The sites-available directory contains configuration files for each website.
The sites-available contains links to the configuration file in the sites-available directory.  It does not contain the file itself.

The mistake that is made at times is that *all* configs are placed in one file – default.

So, for a domain name like domain.com you would create a file called domain.com in the sites-available directory with the following:

NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot /var/www/domain
ServerName www.domain.com
Server Alias domain.com
</VirtualHost>

you would do:  /ln -s /etc/apache2/sites-available/domain.com /etc/apache2/sites-enabled/domain.com

OR

a2ensite domain.com (from within the sites-available) directory.

finally:  /etc/init.d/apache2 reload

So, in a nutshell — create a file per domain name — use ServerAlias to cover www.domain.com and domain.com.

Andrew Hosting , , , , , ,

Rails Newb – how to install will_paginate

January 24th, 2010

One of the frustrating things about Rails is coming up to speed with everyone else.  A very simple task can be difficult, just because you haven’t done a particular task yet.  Well, that’s ok.  That’s what the community is for.  So, I’m sharing those little things here.

This one is how to install will_paginate.  Not so much how to install it – but how to add a new source to the gem sources.

gem sources

do you see http://gemcutter.org?  if so, skip the next command

gem sources -a http://gemcutter.org

sudo gem install will_paginate

Andrew Development , , , , , ,

Setting up MySQL to use less memory

January 20th, 2010

So, you’re on a VPS with 128MB of RAM or doing development on your Linux workstation and you don’t want MySQL to hog all of the memory — here is what you do:

sudo cp /etc/mysql/my.cnf /etc/mysql/my.cnf.backup
sudo cp /usr/share/doc/mysql-server-5.1/examples/my-small.cnf /etc/mysql/my.cnf
sudo /etc/init.d/mysql restart

** verify the version # on the second command line.

Andrew Development , , , , , , ,

London Stock Exchange Rejects .NET For Open Source

October 7th, 2009

Here is an interesting article.

I’m really curious about the details on this one.    The LSE spokesperson said the following:

“We’ve had a very good working relationship with Microsoft. This is not about moving away from Microsoft.NET. For us this is about getting control over our IT development,” he explained.

So, instead of outsourcing the development of the system, the flat out purchase the company that is developing the system.

There is no question that the outage in 2008 played a role in the decision. What I would give for the details that lead to this decision.  I would love to review the architecture to see how the Windows solution was designed and compare that to the MillenniumExchange solution.

Looking at Microsoft’s own case study, found here, the solution consists of Windows Server 2003 and SQL 2000.  That’s not a typo.  SQL 2000!

Listening to the video, the evolution is from a mainframe to a Microsoft platform.  Interestingly enough, the video shows a screen shot for SQL 2005.

Looking over a few blogs and articles, opinions slam Microsoft.  However, I find it interesting how someone can have such a strong opinion when there are not enough details about the implementation of these technologies.

I’m guessing that because of SUN’s involvement, that it’s based on the J2EE technology.

Call me a geek, but if a book was written on this case study, I would be in line to buy it.  Probably the only one in line, but I would be in line.

Andrew Development , , , , ,

Preparing a VPS for Ruby on Rails

October 5th, 2009

The instructions have been updated here.

Here are the steps I use to install Ruby on Rails on my VPS (www.rackspacecloud.com) a Ubuntu  9.04 (jaunty)

apt-get update
apt-get upgrade
apt-get install build-essential
aptitude install ruby1.8-dev ruby1.8 ri1.8 rdoc1.8 irb1.8 libreadline-ruby1.8 libruby1.8 libopenssl-ruby sqlite3 libsqlite3-ruby1.8
aptitude install ruby build-essential libopenssl-ruby ruby1.8-dev
apt-get install sqlite3 libsqlite3-ruby1.8
apt-get install rubygems
ln -s /usr/bin/gem1.8 /usr/local/bin/gem
ln -s /usr/bin/ruby1.8 /usr/local/bin/ruby
ln -s /usr/bin/rdoc1.8 /usr/local/bin/rdoc
ln -s /usr/bin/ri1.8 /usr/local/bin/ri
ln -s /usr/bin/irb1.8 /usr/local/bin/irb
export PATH=$PATH:/var/lib/gems/1.8/bin
gem install -v=2.3.4 rails
gem install rubygems-update
update_rubygems
gem install rails
gem install -v=2.3.4 rails
export PATH=$PATH:/var/lib/gems/1.8/bin

Andrew Development , , , , , , , , ,

How to find which user / service account Apache is using.

May 7th, 2009

The following command will display the information:

ps -ef | grep apache

For example:

www-data   310  4474  0 May05 ?        00:00:17 /usr/sbin/apache2 -k start
www-data   469  4474  0 May05 ?        00:00:15 /usr/sbin/apache2 -k start
www-data 29914  4474  0 May05 ?        00:00:14 /usr/sbin/apache2 -k start

The account running apache is www-data.

Andrew Where is that again? , ,

WordPress Permissions and Problems – now a solution!

May 6th, 2009

So you’ve installed WordPress and it’s just not working out.   Maybe you’re getting one of these error messages:

“You need to make this file writable before you can save your changes. See the Codex for more information.”

“The uploaded file could not be moved to…”

“Sorry, I can’t write to the directory. You’ll have to either change the permissions on your WordPress directory or create your wp-config.php manually.”

What to do?  Why not toss the entire kitchen sink at it?  After all, that’s what 90% of solutions I found online suggested.

Just chmod 777 the directory and it will work!

Why not just set your password to the name of your blog?

I’m not a person who uses Linux every day of the week, but I do appreciate it and see it’s use in meeting some business goals.  So, I got a bit  frustrated.  I’d fix one problem, discover another, fix that, discover another.  So, I stopped and thought about the situation – I even phoned a friend (thanks Ron!).

There were two facts I had to deal with before moving forward:

1. Not everyone has these problem.

2. The solution is related to permissions, but the way I was fixing them wasn’t the right way.

Then it hit me.  After I uncompressed the download and moved it into the www directory, I did not change the owner of the folder and all child folders/files.

A bit of background, I’m running WordPress on a Ubuntu LAMP Server.  So, I realize the configuration may differ, but if you’re having the same problems, regardless of distro, the solution is the same.

First, figure out what user and group the folder needs.  For my server, it was www-data for both.  So, I used the following command:

chown -R www-data:www-data wordpress

or

chown -R www-data:www-data www

(depending on where you moved the wordpress directory)

Also, you’ll need to set permissions:

chmod -R -v 755 wordpress

or

chmod -R -v 755 www

(again, depending on where you moved the directory)

After completing this step, then go to http://webserver/wordpress (or whatever URL you’re using) and you won’t have the errors listed above.



Andrew Troubleshooting , , , , , ,

4 Ways for Small Businesses to Save Money on Technology

April 1st, 2009

savings1. Backup your Data

The number one priority for an IT department is backups!  Hardware will fail, it is inevitable.   Your ability to recover can cost you nothing more than down time or it can cost you thousands of dollars.  There are three questions you need to consider:  (1) How recoverable is your data?  (2) How long would it take you to resume normal business practices?  (3) How long can your business survive without the data?  Implementing the right backup solution can save you thousands of dollars in the long run – and maybe your business.

2. Virtualize

Virtualization technology offers a small business to consolidate hardware that will save you money in hosting (cooling, power), space, and offers features to make administration a bit easier.  Where it makes the most sense for a small business is in test or beta environments.  You can take PCs or  low-end servers, add additional RAM and turn them into a virtual host using VMWare Server, VMWare ESXi or Citrix XenServer, all for free!  While virtualization can play a huge role in production systems, I do not recommend it unless you are running server class hardware and SAN storage.

The savings is found having to buy less hardware by consolidating several servers in one.  Using a Dell workstation with 8G of memory, I’ve been able to fire up 4 Windows 2003 R2 servers and one Linux server.

There are a few things to keep in mind when doing low-end virtualization:

  • Add as much memory as possible.
  • Use a 64-bit OS on the virtual host.
  • Use at least RAID-0 to improve I/O performance (note: this creates a single point of failure, so watch your backups or use RAID-5).

As your company grow, virtualization will become part of the core infrastructure and you build out your data center.

3. Recycle Old PCs

So you either got a good deal or someone gave you an old PC and you don’t know what to do with it.  Well, recycle the PC by turning it into an Internet workstation.  Using a mix of Open Source technologies, you can setup the PC for someone who’s primary use is using web applications, checking email, and working on documents.  For the Operating System, consider using the Linux distro Ubuntu.  For email, consider using Google’s Gmail.  For documents, consider using Google Documents.

Sounds too good to be true?  Well, the down side is that if you have any problems, you’ll need to have someone who is well versed in Linux.  Depending on your location that might be an easy find or a difficult one.   If you’re not careful, then the cost to support Open Source apps might cost as much, if not more than purchasing commercial products that people find familiar.

Saving your information on Google’s servers makes some people worry.  Of course Google will look at your email and direct targeted advertisements to you.  It’s a trade-off.  Some would argue that GMail isn’t reliable, since there have been a handful of outages over the past couple of years.  Again, it’s free.  If you want fault tolerant, it is going to cost – in either time or money.

Be prepared to learn!  Some people will resist using anything but Microsoft Word.  Or you might have issues with a printe or network driver.  However, end the end, you just might be able to stretch the life out of those PCs before they hit the recycling center in the sky.

4. Reassess your Subscriptions

Subscriptions come in many forms – either in yearly maintenance, upgrade rights, updates or access charges.  At one company where I managed a large budget, maintenance fees was the largest category of costs in all of IT.  Of course, this included costs for commercial Operating Systems, not to mention hardware maintenance.

Here are a few areas that many companies have subscription costs:

  • Anti-virus
  • Workstation OS
  • Server OS
  • Server Applications (SQL, Exchange)
  • Hosting
  • Domain Names
  • Domain Services
  • Workstation Applications
  • Server Applications
  • Internet Access (office, phone)
  • Network Hardware/NOS Maintenance

So the strategy in saving money with your subscriptions is to look closely at what you’re paying.  You might just find that your burning money on things you really don’t need.  Also, check your phone and long distance carefully – that’s where most people blindly pay for things that they don’t use.

In the future, I’ll post more specifics like cost-effective ways to get solid backups, implement virtualization, or configure Linux workstations to work with non-Linux workstations and servers.

Andrew Management , , , , , , , , , , , , ,