Skip to content

Commit

Permalink
Merge pull request xeoncross#8 from asimzeeshan/master
Browse files Browse the repository at this point in the history
Fix locale, MOTD & updates to Webmin
  • Loading branch information
xeoncross committed Nov 9, 2012
2 parents aad5f5c + d65327a commit d8c663e
Show file tree
Hide file tree
Showing 2 changed files with 86 additions and 30 deletions.
16 changes: 14 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,16 @@ When running the iptables or dropbear install you must specify a SSH port. Remem
### Warning! This script is self destructive, it'll overwrite previous configs during reinstallation.

wget --no-check-certificate https://raw.github.com/Xeoncross/lowendscript/master/setup-debian.sh
$ ./setup-debian.sh dotdeb
$ ./setup-debian.sh dotdeb # not required if using Ubuntu
$ ./setup-debian.sh system
$ ./setup-debian.sh dropbear 22 <b>*(or any other port number)</b>
$ ./setup-debian.sh dropbear 22 # or any other port number
$ ./setup-debian.sh iptables
$ ./setup-debian.sh mysql
$ ./setup-debian.sh nginx
$ ./setup-debian.sh php
$ ./setup-debian.sh exim4
$ ./setup-debian.sh site example.com
$ ./setup-debian.sh wordpress example.com

#### ... and now time for some extras

Expand Down Expand Up @@ -73,6 +74,16 @@ Either you want to generate ssh-keys (id_rsa) or a custom key for something (rsy
Note: argument is optional, if its left out, it will write "id_rsa" key

$ ./setup-debian.sh sshkey [optional argument_1]

##### Extras

Fixing locale on some OpenVZ Ubuntu templates

$ ./setup-debian.sh locale

Configure or reconfigure MOTD

$ ./setup-debian.sh motd

## After installation

Expand All @@ -90,3 +101,4 @@ For security reasons delete, move or password protect "new_domain/public/phpinfo
- [ilevkov](https://github.com/ilevkov/lowendscript),
- [asimzeeshan](https://github.com/asimzeeshan)
- and many others!

100 changes: 72 additions & 28 deletions setup-debian.sh
Original file line number Diff line number Diff line change
Expand Up @@ -769,7 +769,6 @@ function remove_unneeded {
############################################################
# Download ps_mem.py
############################################################

function install_ps_mem {
wget http://www.pixelbeat.org/scripts/ps_mem.py -O ~/ps_mem.py
chmod 700 ~/ps_mem.py
Expand All @@ -778,7 +777,7 @@ function install_ps_mem {
}

############################################################
# Install vzfree (Ubuntu OpenVZ containers only)
# Install vzfree (OpenVZ containers only)
############################################################
function install_vzfree {
print_warn "build-essential package is now being installed which will take additional diskspace"
Expand All @@ -797,35 +796,53 @@ function install_vzfree {
# Install Webmin
############################################################
function install_webmin {
print_warn "Make sure you have update the apt file first RUN 'bash setup-debian.sh apt' TO UPDATE"
print_info "Downloading required packages"

# Temporary workaround at the moment, will fix it later
apt-get install -q -y perl libnet-ssleay-perl openssl libauthen-pam-perl libpam-runtime libio-pty-perl

print_warn "Make sure you have update the apt file first RUN 'bash `basename $0` apt' to update the /etc/apt/sources.list"

print_info "Installing required packages"
check_install perl perl
check_install libnet-ssleay-perl libnet-ssleay-perl
check_install openssl openssl
check_install libauthen-pam-perl libauthen-pam-perl
check_install libpam-runtime libpam-runtime
check_install libio-pty-perl libio-pty-perl
check_install libapt-pkg-perl libapt-pkg-perl
check_install apt-show-versions apt-show-versions

# Making sure there are no other dependancies left
apt-get upgrade -q -y -f

# Download and install Webmin
print_info "Downloading Webmin"
wget http://www.webmin.com/download/deb/webmin-current.deb -O /tmp/webmin.deb
print_info "Installing webmin ..."
dpkg -i /tmp/webmin.deb
rm -fr /tmp/webmin.deb
print_info "Not: If the installation ends with an error, please run it again"
print_warn "Special Note: If the installation ends with an error, please run it again"
}

############################################################
# Generate SSH Key
############################################################
function gen_ssh_key {
print_warn "Generating the ssh-key (1024 bit)"
if [ -z "$1" ]
then
ssh-keygen -t dsa -b 1024 -f ~/id_rsa
print_warn "generated ~/id_rsa"
else
ssh-keygen -t dsa -b 1024 -f ~/"$1"
print_warn "generated ~/$1"
fi
print_warn "Generating the ssh-key (1024 bit)"
if [ -z "$1" ]
then
ssh-keygen -t dsa -b 1024 -f ~/id_rsa
print_warn "generated ~/id_rsa"
else
ssh-keygen -t dsa -b 1024 -f ~/"$1"
print_warn "generated ~/$1"
fi
}

############################################################
# Configure MOTD at login
############################################################
function configure_motd {
apt_clean_all
update_upgrade
check_install landscape-common landscape-common
dpkg-reconfigure landscape-common
}

############################################################
Expand Down Expand Up @@ -877,11 +894,32 @@ function show_os_arch_version {
print_info "$OS_SUMMARY"
}

############################################################
# Fix locale for OpenVZ Ubuntu templates
############################################################
function fix_locale {
check_install multipath-tools multipath-tools
export LANGUAGE=en_US.UTF-8
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8

# Generate locale
locale-gen en_US.UTF-8
dpkg-reconfigure locales
}

function apt_clean_all {
apt-get clean all
}

function update_upgrade {
# Run through the apt-get update/upgrade first. This should be done before
# we try to install any package
apt-get -q -y update
apt-get -q -y upgrade

# also remove the orphaned stuf
apt-get -q -y autoremove
}

function update_timezone {
Expand Down Expand Up @@ -916,7 +954,7 @@ site)
;;
wordpress)
install_wordpress $2
;;
;;
mysqluser)
install_mysqluser $2
;;
Expand All @@ -936,14 +974,20 @@ webmin)
install_webmin
;;
sshkey)
gen_ssh_key $2
;;
gen_ssh_key $2
;;
motd)
configure_motd
;;
locale)
fix_locale
;;
test)
runtests
;;
info)
show_os_arch_version
;;
show_os_arch_version
;;
system)
update_timezone
remove_unneeded
Expand All @@ -958,8 +1002,8 @@ system)
install_syslogd
;;
*)
show_os_arch_version
echo ' '
show_os_arch_version
echo ' '
echo 'Usage:' `basename $0` '[option] [argument]'
echo 'Available options (in recomended order):'
echo ' - dotdeb (install dotdeb apt source for nginx +1.0)'
Expand All @@ -975,13 +1019,13 @@ system)
echo ' - mysqluser [domain.tld] (create matching mysql user and database)'
echo ' '
echo '... and now some extras'
echo ' - info (Displays information about the OS, ARCH and VERSION)'
echo ' - sshkey (Generate SSH key)'
echo ' - info (Displays information about the OS, ARCH and VERSION)'
echo ' - sshkey (Generate SSH key)'
echo ' - apt (update sources.list for UBUNTU only)'
echo ' - ps_mem (Download the handy python script to report memory usage)'
echo ' - vzfree (Install vzfree for correct memory reporting on OpenVZ VPS)'
echo ' - webmin (Install Webmin for VPS management)'
echo ' - test (Run the classic disk IO and classic cachefly network test)'
echo ' '
;;
esac
esac

0 comments on commit d8c663e

Please sign in to comment.