jump to navigation

BLOG IS MOVING June 27, 2009

Posted by ModelR in Computer Services, Everything LINUX, Everything WINDOWS, General Computer Related, UBUNTU LAMP Project, Uncategorized.
add a comment

I’m moving the blog to it’s own Domain: techkrunch.co.cc

See you there!

Advertisements

Script To Fix eth0 After Moving VM January 11, 2009

Posted by ModelR in UBUNTU LAMP Project.
add a comment
THIS IS A SUBSECTION OF THE VERY VITAL UBUNTU LAMP SERVER PROJECT

You can find the full outline of this project here:
LINK: Very Vital Ubuntu LAMP Server Project Outline

Please support this project.
Make A Donation

Download a copy of the script to look over: fixeth0.sh in text format

Create a new file called “/usr/local/bin/fixeth0.sh:
$ sudo nano /usr/local/bin/fixeth0.sh

#!/bin/bash
# Script to fix eth0 as a result of moving the VM
echo ""
echo "************************************"
echo "*VM HAS MOVED NOW WE'RE FIXING ETH0*"
echo "************************************"
echo ""
if [ $(id -u) -eq 0 ]; then
sudo rm /etc/udev/rules.d/70-persistent-net.rules
sudo shutdown -r now
else
echo "Only root can delete a user from the system"
exit 2
fi

Make the script executable
$ sudo chmod 755 /usr/local/bin/fixeth0.sh

Script To Delete A User January 11, 2009

Posted by ModelR in UBUNTU LAMP Project.
add a comment
THIS IS A SUBSECTION OF THE VERY VITAL UBUNTU LAMP SERVER PROJECT

You can find the full outline of this project here:
LINK: Very Vital Ubuntu LAMP Server Project Outline

Please support this project.
Make A Donation

Download a copy of the script to look over: removeuser.sh in text format

Create a new file called “/usr/local/bin/removeuser.sh:
$ sudo nano /usr/local/bin/removeuser.sh

#!/bin/bash
# Script to remove a user to Linux system
echo ""
echo "******************************"
echo "*Delete a user from the system*"
echo "******************************"
echo ""
if [ $(id -u) -eq 0 ]; then
read -p "Enter username : " username
egrep "^$username" /etc/passwd >/dev/null
if [ $? -eq 0 ]; then
read -p "Delete $username from the system? Type YES To delete: " confirm
if [ "$confirm" == "YES" ]; then
smbpasswd -x $username
deluser $username
rm -rf /home/$username
echo ""
echo ""
echo "$username successfully removed from the system."
echo ""
else
echo ""
echo "$username was not deleted."
echo ""
exit 1
fi
else
echo ""
echo "$username does not exist"
echo ""
fi
else
echo "Only root can delete a user from the system"
exit 2
fi

Make the script executable
$ sudo chmod 755 /usr/local/bin/removeuser.sh

Script To Create New Users January 11, 2009

Posted by ModelR in UBUNTU LAMP Project.
add a comment
THIS IS A SUBSECTION OF THE VERY VITAL UBUNTU LAMP SERVER PROJECT

You can find the full outline of this project here:
LINK: Very Vital Ubuntu LAMP Server Project Outline

Please support this project.
Make A Donation

Download a copy of the script to look over: newuser.sh in text format

Create a new file called “/usr/local/bin/newuser.sh:
$ sudo nano /usr/local/bin/newuser.sh

Edit the file with the following:
#!/bin/bash
# Script to add a user to Linux system
echo ""
echo "******************************"
echo "*Add a new user to the system*"
echo "******************************"
echo ""
if [ $(id -u) -eq 0 ]; then
read -p "Enter username : " username
egrep "^$username" /etc/passwd >/dev/null
if [ $? -eq 0 ]; then
echo "$username already exists!"
exit 1
else
#CREATE THE USER
sudo useradd -d /home/$username -m $username
echo ""

#SET THE UNIX PASSWORD FOR THE USER
echo "Create a SYSTEM password for $username"
let done=0
while [ $done -eq 0 ]; do
passwd $username
echo ""
egrep "^$username\:!:" /etc/shadow >/dev/null
if [ $? -eq 0 ]; then
echo " Could not create a SYSTEM password for $username."
echo " Please try again."
echo ""
else
let done=1
echo " SYSTEM password for $username was successfully created."
echo ""
fi
done

#CREATE THE public_html DIRECTORY AND CHANGE OWNERSHIP TO USER
mkdir /home/$username/public_html
chown $username:$username /home/$username/public_html

#ADD THE APACHE USER ACCOUNT TO THE USER'S GROUP
sudo usermod -a -G $username www-data

#SET THE PASSWORD FOR MYSQL AND SAMBA
echo "Create a MySQL and Samba password"
let done=0
while [ $done -eq 0 ]; do
read -s -p "MySQL & Samba Password: " PASS1
echo ""
read -s -p "Confirm the MySQL & Samba password: " PASS2
echo ""
echo ""
if [ "$PASS1" == "$PASS2" ]; then
let done=1
#CREATE THE MYSQL AND SAMBA PASSWORD
echo "Creating the Samba User and Password"
smbpasswd -e $username
(echo $PASS1; echo $PASS1) | smbpasswd -s -a $username
echo "Please enter the MySQL root password to complete the user setup"

echo ""

echo " MySQL & Samba password successfully created for $username."
echo ""
else
echo "The passwords do not match, please try again."
echo ""
fi
done

#FINISH
echo " $username was successfully created."
echo ""

echo ""
echo "***********************"
echo "RESTARTING APACHE"
sudo /etc/init.d/apache2 restart
echo "***********************"
echo ""

echo ""
echo "***********************"
echo "*Your home directory is /home/$username"
echo "***********************"
echo ""
echo "**********************"
echo "*Your Web directory is /home/$username/public_html"
echo "**********************"
echo ""
echo "******************************"
echo "*The Samba share directory is" '\\'$(hostname)'\'"homes"'\'
echo "******************************"
echo ""
fi
else
echo "Only root may add a user to the system"
exit 2
fi

Make the script executable
$ sudo chmod 755 /usr/local/bin/newuser.sh

Enabling Samba Shares January 11, 2009

Posted by ModelR in UBUNTU LAMP Project.
add a comment
THIS IS A SUBSECTION OF THE VERY VITAL UBUNTU LAMP SERVER PROJECT

You can find the full outline of this project here:
LINK: Very Vital Ubuntu LAMP Server Project Outline

Please support this project.
Make A Donation

To enable each user access to their Samba shares over the network, we will have to edit the Samba configuration file located here: /etc/samba/smb.conf

Before we begin we will create a backup
$ sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.master

Erase the entire contents of smb.conf and add the following:
#======================= Global Settings =======================
[global]
workgroup = WORKGROUP
server string = %h server (Samba, Ubuntu)
dns proxy = no
log file = /var/log/samba/log.%m
max log size = 1000
syslog = 0
####### Authentication #######
security = user
encrypt passwords = true
passdb backend = tdbsam
obey pam restrictions = yes
unix password sync = yes
passwd program = /usr/bin/passwd %u
passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n$
pam password change = yes
map to guest = bad user
########## Printing ##########
load printers = no
printing = bsd
printcap name = /dev/null
disable spoolss = yes
############ Misc ############
socket options = TCP_NODELAY
#======================= Share Definitions =======================
[homes]
comment = Home Directories
browseable = yes
read only = no
create mask = 0755
valid users = %S

Restart the samba server
$ sudo /etc/init.d/samba restart

phpMyAdmin Multiple Users Setup January 11, 2009

Posted by ModelR in UBUNTU LAMP Project.
2 comments
THIS IS A SUBSECTION OF THE VERY VITAL UBUNTU LAMP SERVER PROJECT

You can find the full outline of this project here:
LINK: Very Vital Ubuntu LAMP Server Project Outline

Please support this project.
Make A Donation

Also see this website for more options: Configuring phpMyAdmin for multiple users

The goal that we wish to achieve, is to allow multiple users to use phpMyAdmin only seeing and having permissions for their own databases. The root user will be able to see all databases. To get to this goal we will have to make a few changes to the config file located here: /etc/phpmyadmin/config.inc.php

Before we begin we will make a backup of the file before editing it
$ sudo cp /etc/phpmyadmin/config.inc.php /etc/phpmyadmin/config.inc.php.master

Here is what will have to be changed:
Uncommented the following
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['connect_type'] = 'tcp';

Uncommented and changed mysql to mysqli in the following line
$cfg['Servers'][$i]['extension'] = 'mysqli';

After this line
// $cfg[‘Servers’][$i][‘controlpass’] = ‘pmapass’;
We added this
$cfg['Servers'][$i]['hide_db'] = 'information_schema';

Then we added this line as the last line
$cfg['AllowUserDropDatabase'] = true;

That’s it.

Ubuntu Updates and Installs December 20, 2008

Posted by ModelR in UBUNTU LAMP Project.
add a comment
THIS IS A SUBSECTION OF THE VERY VITAL UBUNTU LAMP SERVER PROJECT

You can find the full outline of this project here:
LINK: Very Vital Ubuntu LAMP Server Project Outline

Please support this project.
Make A Donation

Just a quick recap. Basically we have installed the Jeos server. Now it’s fresh and ready for us to customize.

First we will run a check for updates with the following command:
$ sudo apt-get update && sudo apt-get upgrade

Then we will move on to installing VMware Tools
You can also refer to this documentation: Ubuntu Help on installing VMware Tools
Or documentation more specific to Jeos:Installing VMware Tools on Jeos
Here are the commands we will run:
$ sudo aptitude install build-essential linux-headers-$(uname -r)

$ sudo aptitude install psmisc

On the VMware server console, click: VM -> Install VMware Tools

$ mount /media/cdrom0

$ sudo cp -a /media/cdrom0/VMwareTools*.gz /tmp/
$ cd /tmp/
$ sudo tar -xzvf VMwareTools*.gz

$ cd vmware-tools-distrib/
$ sudo ./vmware-install.pl

Accept all the default settings when asked for input

—-
Now that all that is out of the way we will install the LAMP package
NOTE: To install the various LAMP components on a Debian system, see this article here: http://www.howtoforge.com/ubuntu_debian_lamp_server

$ sudo apt-get install lamp-server^

Install the OpenSSH server
$ sudo apt-get install openssh-server

Install the Samba server
$ sudo apt-get install samba

Install phpMyAdmin
$ sudo apt-get install phpmyadmin

Install GD Graphics Library
$ sudo apt-get install php5-gd

Installed the Nano text editor (it’s more convenient to use than vi)
$ sudo apt-get install nano

Installed cURL
$ sudo apt-get install curl libcurl3 libcurl3-dev php5-curl

Give the tmp directory proper permissions
$ sudo chmod 1777 /tmp

On the STANDARD version, enabled the userdirectory module
Now each user can store their own website in their /home/username/public_html directory
$ sudo a2enmod userdir

—–
We will create a first run script to change the user1 password and the MySQL root password

add the following to bottom of /etc/bash.bashrc:

if [ ! -e /etc/opt/first-run/initial_config_done ]; then
/opt/first-run/initial_config.sh
sudo touch /etc/opt/first-run/initial_config_done
fi

create a sub-directory called first-run in /opt/
$ sudo mkdir /opt/first-run/

create a sub-directory called first-run in /etc/opt/
$ sudo mkdir /etc/opt/first-run/

create this file:
/opt/first-run/initial_config.sh

edit the file initial_config with a text editor, entering this:
#!/bin/bash

# FIX THE NETWORK BY DELETING A FILE
echo ""
echo ""
sudo rm -rf /etc/udev/rules.d/70-persistent-net.rules
echo ""
echo ""
echo ""
echo "Thank you for choosing the Very Vital LAMP Server"
echo "This is the FIRST RUN of this server"
echo "We are going to go through a few setup steps"
echo "Then we will reboot the server"
echo ""
echo "For your security we will now change your password"
let done=0
while [ $done -eq 0 ]; do
read -s -p "New password: " NEWPASS1
echo""
read -s -p "Confirm new password: " NEWPASS2
echo ""
if [ "$NEWPASS1" == "$NEWPASS2" ]; then
let done=1
(echo $NEWPASS1; echo $NEWPASS1) | passwd
else
echo "The passwords do not match, please try again."
echo ""
fi
done

# Now change the mysql password
echo ""
echo ""
echo "Please specify a new MySQL root password"
let done=0
while [ $done -eq 0 ]; do
read -e -s -r -p "New MySQL root password:" PASS1
echo ""
read -e -s -r -p "Confirm the MySQL root password:" PASS2
if [[ "$PASS1" == "$PASS2" ]]; then
let done=1
#perfrom the actual change assuming that our initial password is root
mysqladmin -u root --password='root' password $PASS1
else
echo "The passwords do not match, please try again."
fi
done

#Perform the reinstall of openssh so that the key is regenerated
echo ""
echo ""
echo "Would you like to create new SSH keys?"
echo "Please note that you will require an internet connection"
echo "If you do not have an internet connection type NO"
echo "Otherwise you will not be able to use SSH to connect to this server"
read -p "Create new SSH keys? Type YES to create new: " confirm
if [ "$confirm" == "YES" ]; then
echo "We are now going to generate your ssh keys"
sudo apt-get .purge -y remove openssh-server
sudo apt-get install -y openssh-server
echo ""
else
echo ""
echo "SSH new key creation successfully aborted."
echo ""
fi
# ADDITIONAL FIRST USER LOGIN ACTIONS BELOW
echo ""
echo "The current hostname is: "$(hostname)
read -p "Would you like to change it? Type YES to change: " change
if [ "$change" == "YES" ]; then
echo ""
echo "Note: After name change system will reboot"
read -p "Enter new hostname : " newhost
cat /etc/hostname | sed -e {'s/'$(hostname)'/'$newhost'/'} > /tmp/hostname2
cat /etc/hosts | sed -e {'s/'$(hostname)'/'$newhost'/'} > /tmp/hosts2
sudo rm -rf /etc/hostname
sudo mv /tmp/hostname2 /etc/hostname
sudo rm -rf /etc/hosts
sudo mv /tmp/hosts2 /etc/hosts
echo "The hostname has been changed to: "$newhost
echo ""
else
echo ""
echo "Current hostname is still the same: "$(hostname)
echo ""
fi
echo "You have completed the FIRST RUN"
echo "Before you start please reboot the system"
echo "Type this command to reboot the system: sudo init 6"
echo ""

Then we’ll make the above script executable
$ sudo chmod a+x /opt/first-run/initial_config.sh
—–
Now we will start cleaning up the VM
$ sudo apt-get clean

We right null to a file
$ sudo dd if=/dev/null of=junk
Then we run this command
$ sync

We will fill the unused space with zeros
$ sudo dd if=/dev/zero of=junk
After running this you will get the message
“dd: writing to ‘junk’: No space left on device”

Then we run this command
$ sync
And now we remove the junk file
$ sudo rm junk

Clear the commands that we have typed
$ history -c
or we can edit this file and delete it's contents:
/home/user1/.bash_history

Installing Ubuntu JeOS Edition December 19, 2008

Posted by ModelR in UBUNTU LAMP Project.
add a comment
THIS IS A SUBSECTION OF THE VERY VITAL UBUNTU LAMP SERVER PROJECT

You can find the full outline of this project here:
LINK: Very Vital Ubuntu LAMP Server Project Outline

Please support this project.
Make A Donation

-I will include selected screenshots that are usefull.

*This is the first screen that you will see when you boot from the Ubuntu Jeos image file
First screen of the Ubuntu Jeos install

*This is the main install screen for Ubuntu Jeos
First screen of the Ubuntu Jeos install

*In this step you will be given the option to choose the language for your install
First screen of the Ubuntu Jeos install

*In this screen you are asked to provide your location -> Not sure if you’ve noticed yet, but so far we have been selecting all defaults. (Nice, this makes it pretty easy)
First screen of the Ubuntu Jeos install

*Here is where we stray from the defaults. We choose not to detect the keyboard
First screen of the Ubuntu Jeos install

*We choose the origin of the keyboard
First screen of the Ubuntu Jeos install

*Making the choice of a standard layout
First screen of the Ubuntu Jeos install

*After these choices, the installer goes through the process of detecting hardware and such.
——
*Now it’s time to make some decisions. Here we select the hostname for the server
First screen of the Ubuntu Jeos install

*Here we are selecting the timezone for the clock setup
First screen of the Ubuntu Jeos install

*Then the installer proceeds to detect some more hardware (disks). We strayed from the defaults and made this selection.
First screen of the Ubuntu Jeos install

*As you can see we have a 2GB SCSI disk on our VM
First screen of the Ubuntu Jeos install

*Here we choose to write changes to the disk and configure LVM
First screen of the Ubuntu Jeos install

*Here we give authorization to follow through with what we have selected (formating, writing partition, etc.)
First screen of the Ubuntu Jeos install

*The system goes through the process of writing the changes to the disks, then proceeds to install the base system
——

*Time for some more decisions. Here we enter in the full name we have chosen for the first user
First screen of the Ubuntu Jeos install

*Now we enter the username for that first user (this is the logon name)
First screen of the Ubuntu Jeos install

*Here is where we enter the password for the user we are creating
First screen of the Ubuntu Jeos install

*Verifying the password
First screen of the Ubuntu Jeos install

*Here we specify our proxy server (that’s if we have one, which we don’t, so it’s left blank)
First screen of the Ubuntu Jeos install

*The install goes through with some background work
—–

*Installation verifies if your system clock is set to UTC or has been changed to local time by another operating system (we’ll leave the answer as yes)
First screen of the Ubuntu Jeos install

After all this the Jeos is finished installing and ready to go after a reboot. Remove the installation media and, hit continue to reboot.

Ubuntu LAMP Server Project Outline December 17, 2008

Posted by ModelR in UBUNTU LAMP Project.
add a comment

DESCRIPTION
This is a project that I have started because I was in need of a LAMP server. The features that I needed were not available pre-configured in other LAMP servers. I decided to make an easily updated and adaptable server for VMware (also called a Virtual Machine or Appliance).

DONATIONS
Compiling all this information in an easy to follow guide and also making revisions requires a lot of time. If you feel that the information that you find in these pages is beneficial please donate to the cause.
Make A Donation

OUTLINE
Initial Installation
Installing Ubuntu Jeos Edition
Configurations
Ubuntu Updates and Installs
Enabling Samba Shares
Script To Create New Users
Script To Delete A User
Script To Fix eth0 After Moving VM
STANDARD Edition Enhancements
phpMyAdmin Multiple Users setup

GENERAL NOTES
PLEASE CHANGE USER NAMES AND PASSWORDS!!
To make your setup secure change the appropriate settings.

System:
256Mb of RAM
2 Gb Hard drive
1 Network card

Hostname: jeos-lamp

Users:

username: user1 password: user1
The first user. You can also use sudo with this user. The sudo password for this user is user1

MySQL
username: root password: root

Creating New User’s:

To create a new user run the script: /usr/local/bin/newuser.sh as sudo and follow the on-screen directions.

Deleting New User’s:

To delete a user run the script: /usr/local/bin/removeuser.sh as sudo and follow the on-screen directions.

To Fix eth0:

To fix eth0 run the script: /usr/local/bin/removeuser.sh as sudo. This will fix eth0 if it has stopped working after you move the VM to a new directory or such

Shares:

To get to the share directory of the user, go to \\jeos-lamp\ and login as the user

Directories:

  • user1’s home directory: /home/user1
  • user1’s Apache/Web directory: /home/user1/public_html

Databases:

Currently there aren’t any databases on the server. Use phpMyAdmin to create the databases.

When creating users in phpMyAdmin make sure to:

  • Set the location to localhost
  • select “Grant all privileges on wildcard name (username\_%)”
REQUIREMENTS
In order to run these VMs, you will need VMware Player (you can also use VMware server). Don’t worry it’s FREE.

Download Link: VMware Player

LATEST RELEASES

Very Vital Ubuntu LAMP Server – BASE Edition v0.01
Download File Size: 221MB

Very Vital Ubuntu LAMP Server – STANDARD Edition v1.00
Download File Size: 221MB

Very Vital Ubuntu LAMP Server – ULTIMATE Edition v0.00
COMING SOON

Make A Donation

BUG REPORTS / FEATURE REQUESTS
If you would like to request features to be included in the next release, or if you have a bug to report, please place it in the comments of this post.

  • FEATURE REQUEST: Management Console

REVISION HISTORY

Very Vital Ubuntu LAMP Server – STANDARD Edition
V1.00

  • Initial version
    Ubuntu 8.10 JeOS
  • Last Updates Run on: Jan. 14, 2009
  • Package contains:
    VMware Tools
    OpenSSH server
    Samba file server
    phpMyAdmin
    nano (text editor)
    GD Graphics Library
  • Configurations:
    Installed cURL
    Enabled the userdirectory module
    Configured phpmyadmin for multiple users. All users, (except for root), are only able to see their own databases
    Included a script to create new users
    Included a script to remove users
    Included a script to fix eth0
Very Vital Ubuntu LAMP Server – BASE Edition
V1.00

  • Initial version
    Ubuntu 8.10 JeOS
  • Last Updates Run on: Jan. 14, 2009
  • Package contains:
    VMware Tools
    OpenSSH server
    Samba file server
    phpMyAdmin
    nano (text editor)
    GD Graphics Library
  • Configurations:
    Installed cURL
    Included a script to create new users
    Included a script to remove users
    Included a script to fix eth0