Labels

Wednesday, August 14, 2013

Setup Git Repository

I created a Git server to host our companies code repositories.  It is an ubuntu server with ssh enabled and git installed.  Here are steps I use to create a new repository:
1. Create directory to host new repository
$ sudo mkdir /testrepo1
2. Change group of repository directory to group used by developers that will be using this repository
$ sudo chgrp -R git /testrepo1
3. Change default permissions on directory so that all new files will be crated with the new group
$ sudo chmod g+rws /testrepo1
$ sudo git --base /testrepo1
4. Initialize empty Git repository
$ cd /testrepo1
$ git --bare init --shared=group

Thursday, May 16, 2013

InnoDB: Unable to lock ./ibdata1, error: 11

This is an error I see in the logs from time to time.  I am running a MySQL server with an openvz container on a Proxmox server.  From time to time the Proxmox server will crash which causes all the VMs it is running to stop unexpectedly (in defense of Proxmox this has only happened on a development box that is installed on a workstation).  When I attempt to access the MySQL server through the MySQL Workbench I get an error like "Can't connect to the MySQL server on <server name> (111)":
I also receive an error when trying to access the database from the command line:
# mysql -u root -p
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

In the logs I found:
InnoDB: Unable to lock ./ibdata1, error: 11
InnoDB: Check that you do not already have another mysqld process
InnoDB: using the same InnoDB data or log files.
InnoDB: Error in opening ./ibdata1

I was able to fix the problem by restoring the permissions on several files (modified from this post):
# cd /var/lib/mysql
# mkdir bak
# mv ibdata1 bak/.
# mv ib_logfile* bak/.
# cp -a bak/ibdata1 ibdata1
# cp -a bak/ib_logfile* .
# service mysql restart

Wednesday, April 10, 2013

Ubuntu 12.04 Joomla 3

I recently setup an Ubuntu server with Joomla 3.  I used the instructions found here with a few modifications.  I did not want the joomla site to be under the /joomla subdirectory so I skipped the first three commands under step 2.  The steps I used are as follows:

  1. sudo apt-get install lamp-server^
    mysql -u root -p
    CREATE DATABASE dbjoomla;
    CREATE USER joomlauser;
    (Change <password> to the password of your choice)
    SET PASSWORD FOR joomlauser = PASSWORD("<password>");
    GRANT ALL PRIVILEGES ON dbjoomla.* TO joomlauser@localhost IDENTIFIED BY '<password>';
    FLUSH PRIVILEGES;
    exit
    wget http://joomlacode.org/gf/download/frsrelease/17965/78414/Joomla_3.0.3-Stable-Full_Package.zip
    sudo unzip -q Joomla_3.0.1-Stable-Full_Package.zip -d /var/www
    You will want to remove the index.html that exists in /var/www by default
    sudo chown -R www-data.www-data /var/www
    Install joomla 3.0 from a browser by typing http://[hostname]

Wednesday, February 13, 2013

Locale error

August 8, 2012

I had been getting an error on some Ubuntu servers when using apt:
locale: Cannot set LC_CTYPE to default locale: No such file or directory       
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory             

After some googling I found a solution:

localedef -v -c -i en_US -f UTF-8 en_US.UTF-8                                            

EDIT:  This occurs when I setup Ubuntu 12.04 servers using an openvz image that I downloaded (I don't remember from where).

 

Thursday, June 14, 2012

Expand Proxmox VM

These are the steps I took to expand the hard drive of a Windows 2003 server running on Proxmox
I found these steps here.

  1. Shutdown server
  2. Create backup
  3. Expand disk in my case it was to 60GB which is 64424509440 bytes which you divide by the bit size for the "seek" option (125829120):
  4. ~# cd /var/lib/vz/images/101
    ~# dd if=/dev/zero of=vm-101-disk-1.raw bs=512 count=0 seek=125829120

  5. Restart pvedaemon:
  6. ~# /etc/init.d/pvedaemon restart

  7. Add GParted live CD to virtual CD drive and boot server
  8. Resize NTFS partition with GParted interface
  9. Reboot server (Windows will run a constistency check because of the new disk size)

Wednesday, March 7, 2012

Glassfish 3.1.2 on Ubuntu 11.10

These are the steps I took to install Glassfish 3.1.2 on Ubuntu 11.10.

I should point out that I used a Proxmox KVM virtual server for this.  I first tried an OpenVZ virtual server but kept running into an error: "There is a process already using the admin port 4848 -- it probably is another instance of a GlassFish server."  After some googling I decided this error had something to do with the networking which is significantly different on OpenVZ than KVM so I abandoned the OpenVZ container and created a KVM virtual host.

These steps are a combination of two other guides in order to provide an internal Glassfish server that is password protected (here and here).

Before I began I installed Ubuntu 11.10 server (64-bit) on the Proxmox KVM virtual machine and updated to the latest available updates then backed-up the virtual machine.

  1. Install Java (I chose the natively available version of Java, openjdk):
  2. ~# sudo apt-get install openjdk-7-jdk
  3. Install the unzip utility (not included by default in Ubuntu 11.10):
  4. ~# sudo apt-get install unzip
  5. Create user and group to install and run Glassfish (I chose glassfish and glassfishadm):
  6. ~# sudo adduser --home /home/glassfish --system --shell /bin/bash glassfish
    ~# sudo groupadd glassfishadm
    ~# sudo usermod -a -G glassfishadm glassfish
  7. Change to glassfish user:
  8. ~# sudo su - glassfish
  9. Get Glassfish zip:
  10. ~# wget http://download.java.net/glassfish/3.1.1/release/glassfish-3.1.1.zip
  11. Unzip glassfish and move it to root of glassfish user home folder:
  12. ~# unzip glassfish-3.1.2.zip
    ~# mv glassfish3/* .

    ~# rm -r glassfish3
    ~# rm glassfish-3.1.2.zip
  13. Change owner and group of entire folder:
  14. ~# chown -R glassfish *
    ~# chgrp -R glassfishadm *
  15. Exit glassfish user:
  16. ~# exit
  17. Create script to start and stop Glassfish server at /etc/init.d/glassfish.  This script will use the glassfish user to start and stop the Glassfish instance so that it does not run as root:
  18. #!/bin/bash

    case "$1" in
    start)
        su - glassfish -c "/home/glassfish/bin/asadmin start-domain domain1"
        ;;
    stop)
        su - glassfish -c "/home/glassfish/bin/asadmin stop-domain domain1"
        ;;
    restart)
        su - glassfish -c "/home/glassfish/bin/asadmin stop-domain domain1"
        su - glassfish -c "/home/glassfish/bin/asadmin start-domain domain1"
        ;;
    *)
        echo "usage: $0 {start|stop|restart}"
        ;;

    esac

    exit 0
  19. Set script to run at boot:
  20. ~# sudo chmod u+x /etc/init.d/glassfish
    ~# sudo update-rc.d glassfish defaults
  21. Set admin password (default password for admin is blank):
  22. ~# sudo su - glassfish -c "/home/glassfish/bin/asadmin --user admin change-admin-password"
    Enter admin password> _

    Enter new admin password>
    Enter new admin password again>
    Command change-admin-password executed successfully.
  23. Set security on Glassfish:
  24. ~# sudo su - glassfish -c "/home/glassfish/bin/asadmin enable-secure-admin"
  25. Start the server:
  26. ~# sudo /etc/init.d/glassfish start

Friday, January 13, 2012

Redmine on Ubuntu 11.04 using MySQL

I decided to give Redmine a try and ran into a few issues using most of the guides out there to get it installed.  The guide that worked is below but be sure to install your mysql server (sudo apt-get install mysql-server) first.

http://foxfoo.com/howto-install-redmine-on-ubuntu-1104.html