Archive

Posts Tagged ‘Ubuntu’

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 , , , , , ,

Error installing libxml-ruby

February 1st, 2010

So this:

sudo gem install -r libxml-ruby

Gives you this:

ERROR:  Error installing libxml-ruby:
ERROR: Failed to build gem native extension.

/usr/bin/ruby1.8 extconf.rb
checking for socket() in -lsocket… no
checking for gethostbyname() in -lnsl… yes
checking for atan() in -lm… no
checking for atan() in -lm… yes
checking for inflate() in -lz… yes
checking for iconv_open() in -liconv… no
checking for libiconv_open() in -liconv… no
checking for libiconv_open() in -llibiconv… no
checking for iconv_open() in -llibiconv… no
checking for iconv_open() in -lc… yes
checking for xmlParseDoc() in -lxml2… no
checking for xmlParseDoc() in -llibxml2… no
checking for xmlParseDoc() in -lxml2… no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

Provided configuration options:
–with-opt-dir
–without-opt-dir
–with-opt-include
–without-opt-include=${opt-dir}/include
–with-opt-lib
–without-opt-lib=${opt-dir}/lib
–with-make-prog
–without-make-prog
–srcdir=.
–curdir
–ruby=/usr/bin/ruby1.8
–with-iconv-dir
–without-iconv-dir
–with-iconv-include
–without-iconv-include=${iconv-dir}/include
–with-iconv-lib
–without-iconv-lib=${iconv-dir}/lib
–with-zlib-dir
–without-zlib-dir
–with-zlib-include
–without-zlib-include=${zlib-dir}/include
–with-zlib-lib
–without-zlib-lib=${zlib-dir}/lib
–with-socketlib
–without-socketlib
–with-nsllib
–without-nsllib
–with-mlib
–without-mlib
–with-mlib
–without-mlib
–with-zlib
–without-zlib
–with-iconvlib
–without-iconvlib
–with-iconvlib
–without-iconvlib
–with-libiconvlib
–without-libiconvlib
–with-libiconvlib
–without-libiconvlib
–with-clib
–without-clib
–with-xml2-config
–without-xml2-config
–with-xml2-dir
–without-xml2-dir
–with-xml2-include
–without-xml2-include=${xml2-dir}/include
–with-xml2-lib
–without-xml2-lib=${xml2-dir}/lib
–with-xml2lib
–without-xml2lib
–with-libxml2lib
–without-libxml2lib
–with-xml2lib
–without-xml2lib
extconf failure: need libxml2.

Install the library or try one of the following options to extconf.rb:

–with-xml2-config=/path/to/xml2-config
–with-xml2-dir=/path/to/libxml2
–with-xml2-lib=/path/to/libxml2/lib
–with-xml2-include=/path/to/libxml2/include

So, do this:

sudo apt-get install libxml2-dev

And this again:

sudo gem install -r libxml-ruby

Andrew Development , , , , , ,

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 , , , , , ,

Ubuntu – system tray – task bar – exactly what is it?

January 24th, 2010

I’m using Ubuntu 9.10 – the Karmic Koala and I accidentally deleted the default panel.  Default panel?  Well, if you’re a Windows user, you know it as the Task Bar.

In Ubuntu it’s called it’s called a panel.

So, to get it back, here is what you need to do:

Press Alt+F2 enter gnome-terminal

gconftool-2 –shutdown

rm -rf ~/.gconf/apps/panel

pkill gnome-panel

Tada!

Source: http://ubuntuforums.org/showthread.php?t=392387

Andrew Where is that again? , , ,

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 , , , , , , ,

Preparing a VPS for Ruby on Rails – updated

October 11th, 2009

I’ve updatekeep the gearsd my instructions on preparing a VPS for Ruby on Rails, after running into a few issues.  I *think* that installing gems through apt-get caused problems when I was trying to install a CMS called Radiant.

So, here are the new instructions:

apt-get install ruby irb rdoc libopenssl-ruby ruby1.8-dev
apt-get install sqlite3 libsqlite3-ruby1.8

wget http://rubyforge.org/frs/download.php/60718/rubygems-1.3.5.tgz

tar xzvf rubygems-1.3.5.tgz
cd rubygems-1.3.5/
ruby setup.rb

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

gem -v
gem update –system
gem install rails

To install MySQL:

apt-get install mysql-server libmysql-ruby1.8 libmysqlclient15off mysql-client-5.0 mysql-common mysql-server-5.0 mysql-server-core-5.0

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 , , , , , , , , ,

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 , , , , , ,