Showing posts with label debian. Show all posts
Showing posts with label debian. Show all posts

Saturday, August 29, 2015

Install Virtualbox Extension Pack from Bash command line

I recently ran into a problem when upgrading to Virtualbox 5.0. I was not able to install the Extension Pack, to enable USB 2.0, from the command line. Over at virtualbox.org I found the solution.

On my debian box I used aptitude to install gksu. gksu is a GTK+ frontend for su and sudo (check the man page for more info). Then I executed the following command from the directory where I downloaded the Virtualbox Extension Pack.

> gksu VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-5.0.2.vbox-extpack

After executing this command, my Virtualbox VM would boot up just fine and USB 2.0 controller was active.

Monday, March 16, 2015

Installing VMWare Player on Debian Testing (Jessie)



Thanks to linuxg.net for the steps on how to install VMWare Player 6.0.1 on Debian Testing (Jessie). Basically, install a couple of Debian packages needed for building, download the tar ball, untar, and build.

I did run into a problem when running VMWare Player for the first time. Evidently, with some of the 3.x kernels there is a patch that is needed for the vmnet module. Thanks to davejingtian.org for the steps on how to implement the patch.

Thursday, January 16, 2014

Update to: Building PHP 5

this post is an update to: Building Apache 2 and Php 5 from source

after building apache and php following the steps described in the link above, i noticed that when trying to access a mysql database from a php script that the mysqli was not available. the problem was that i did not configure php correctly. i have fixed that with the steps below.

i have included the php build section for context. the only changes are in the parameters to the configure script.


configure and build PHP. configure with Apache 2 and MySQL support.
since apache was built from source, the steps below will match the path for apxs.
cd ../php-NN
./configure --with-apxs2=/usr/local/apache2/bin/apxs 
            --with-mysql=/usr/local/mysql 
            --with-mysqli=mysqlnd
make
make test
make install 
 
 

Thursday, November 7, 2013

Update oracle java on debian linux

i recently ran into a situation where i needed to update java on my debian linux system. this update needed to include the java plugin for my firefox browser, which is a security vector, but is required for some work tasks. my setup is NOT using the default openjdk package that debian provides. i prefer to use oracle java. i wrote a bash script to make all the required calls to update-alternatives to complete the update. below are the steps i followed.

i downloaded the necessary jdk linux tarball from http://www.oracle.com/technetwork/java/javase/downloads/index.html to /share.


>su -
>mkdir /usr/local/src/java
>cp /share/jdk-7u##-linux-i586.tar.gz /usr/local/src/java
>cd /usr/local/src/java
>tar -xvzf jdk-7u##-linux-i586.tar.gz
>bash /share/updateJava.sh
>exit



below are the contents of the script updateJava.sh :


# this script uses debian's update-alternatives to update
# to the latest version of java

javaRoot="/usr/local/src/java/jdk1.7.0_45/"

update-alternatives --install /usr/bin/java java "$javaRoot""bin/java" 1
update-alternatives --install /usr/bin/javac javac "$javaRoot""bin/javac" 1
update-alternatives --install /usr/lib/mozilla/plugins/libjavaplugin.so mozilla-javaplugin.so "$javaRoot""jre/lib/i386/libnpjp2.so" 1

update-alternatives --set java "$javaRoot""bin/java"
update-alternatives --set javac "$javaRoot""bin/javac"
update-alternatives --set mozilla-javaplugin.so "$javaRoot""jre/lib/i386/libnpjp2.so"


 



below is the output of my system:

>java -version
java version "1.7.0_21"
Java(TM) SE Runtime Environment (build 1.7.0_21-b11)
Java HotSpot(TM) Server VM (build 23.21-b01, mixed mode)
 

>bash /share/updateJava.sh
update-alternatives: using /usr/local/src/java/jdk1.7.0_45/bin/java to provide /usr/bin/java (java) in manual mode
update-alternatives: using /usr/local/src/java/jdk1.7.0_45/bin/javac to provide /usr/bin/javac (javac) in manual mode
update-alternatives: using /usr/local/src/java/jdk1.7.0_45/jre/lib/i386/libnpjp2.so to provide /usr/lib/mozilla/plugins/libjavaplugin.so (mozilla-javaplugin.so) in manual mode
 

>java -version
java version "1.7.0_45"
Java(TM) SE Runtime Environment (build 1.7.0_45-b18)
Java HotSpot(TM) Server VM (build 24.45-b08, mixed mode)


info taken from:
http://www.redirecttonull.com/?p=250

Tuesday, November 5, 2013

Update flash plugin in firefox on debian linux

i had an issue where i couldn't watch videos on youtube. i got a message about upgrading the flashplayer in my firefox browser on my debian linux system. after some googling i found the debian wiki page that details how to upgrade the flash plugin for the browser. i executed the following command as root:

update-flashplugin-nonfree --install

if you are behind a proxy like i am the command looks like:

http_proxy=http://myproxy:port update-flashplugin-nonfree --install


info taken from :
https://wiki.debian.org/FlashPlayer

also see:
http://tuxmark.blogspot.com/2013/10/flash-not-working-in-firefox-on-linux.html

Monday, October 28, 2013

event reminder from the command line

i needed a way to set a reminder on my debian system so that i don't forget to attend meetings, since i don't have access to my online calendar. so after some googling, i've found a solution using the at command and zenity dialog.

"at" lets one execute a command at a specific date and time in the future. there are quite a few options.

zenity is a package that provides and easy way to pop-up a custom dialog box. there are quite a few options for zenity as well.


open a terminal, for an event at 9:00am on October 29 enter the following:

at 0900 Oct 29

a "at>" prompt will appear. enter the command to execute:

at> env DISPLAY=:0.0 zenity --info --title "my title" --text "my custom message"

when finished with the command hit the enter key, then press CTRL-D. a job number with date and time for the job will appear.

specify the display device to use for the zenity dialog
env DISPLAY=:0.0

specify a zenity info dialog box
--info

specify the zenity dialog box title
--title "my title"

specify the zenity dialog box message text
--text "my custom message"


info take from:

man page for at command
man page for X
http://www.brunolinux.com/02-The_Terminal/The_at_Command.html
http://lowfatlinux.com/linux-task-scheduler-at.html?ModPagespeed=noscript
http://linux-commands-examples.com/zenity
http://ubuntuforums.org/showthread.php?t=759389&page=2
https://help.ubuntu.com/community/CronHowto
http://www.linuxquestions.org/questions/linux-newbie-8/export-display%3D-0-0-a-682926/

Thursday, October 24, 2013

Flash not working in Firefox on linux

i recently had an issue with successful playing youtube videos in my firefox browser on my debian linux machine. i previously installed the flashplugin-nonfree package to use as the flash plugin and everything worked fine for a while.

after googling around i came to the realization that the following packages

browser-plugin-gnash
gnash
gnash-common

were installed at some point and prevented the correct rendering of flash videos. so i removed the gnash packages with the following command.

aptitude purge browser-plugin-gnash gnash gnash-common


after removing the gnash packages, youtube and other flash videos began working again as expected.

so, how do i prevent gnash from being installed again and causing future problems. i found several interesting solutions, a few are listed at the bottom of this post. i decided to place a hold on the gnash packages (while uninstalled). below is the command i used.

aptitude hold browser-plugin-gnash gnash gnash-common


i've never used hold with apt before, so hopefully this will prevent any future installs of gnash. if anyone has a successful experience preventing specific packages from being installed, i would definitely like to hear your solution.

also check out:
http://tuxmark.blogspot.com/2013/11/update-flash-plugin-in-firefox-on.html


below are a few links i found while researching this issue.

http://www.debian.org/doc/manuals/debian-faq/ch-pkg_basics.en.html
http://askubuntu.com/questions/75895/how-to-forbid-a-specific-package-to-be-installed
http://serverfault.com/questions/17046/preventing-specific-packages-from-getting-installed-in-debian

Wednesday, October 23, 2013

How to post json with curl

i needed to test a php script by posting a json body in the request with curl from the debian linux command line. below is the solution i found.

curl -X POST -H "Content-Type: application/json" -d '{"key": "value"}' http://localhost/myscript.php


info taken from:
http://stackoverflow.com/questions/7172784/how-to-post-json-data-with-curl-from-terminal-commandline-to-test-spring-rest

Tuesday, October 22, 2013

Building Mysql 5.5 from source

following are the steps I used to build from source and install mysql 5.5 on my debian system

download the Mysql 5.5 tarball from mysql.com . become the root user and move the downloaded tarball to /usr/local/src. unpack the mysql tarball with:
tar -xvzf mysql-5.5.xx.tar.gz

add specific user and group to run mysql as:
groupadd mysql
useradd -r -g mysql mysql 

change directory to be inside source tree
cd /usr/local/src/mysql-5.5.xx

execute make commands
cmake .
make
make install

change to install directory
cd /usr/local/mysql

execute post installation setup commands
chown -R mysql .
chgrp -R mysql .
scripts/mysql_install_db --user=mysql
chown -R root .
chwon -R mysql data
cp support-files/my-medium.cnf /etc/my.cnf
bin/mysqld_safe --user=mysql &
cp support-files/mysql.server /etc/init.d/mysql.server

login to mysql command line client and set passwords
mysql -u root -p
enter root password when prompted

display existing users
SELECT User, Host, Password FROM mysql.user;

assign password to the root user
UPDATE mysql.user SET Password = PASSWORD('newpassword') 
    WHERE User = 'root';
FLUSH PRIVILEGES;

assign password to the anonymous user
UPDATE mysql.user SET Password = PASSWORD('newpassword')  
    WHERE User = '';
FLUSH PRIVILEGES;

display existing users to verify passwords have been set
SELECT User, Host, Password FROM mysql.user;


exit mysql command line client
quit

add non-root user to mysql group
usermod -a -G mysql myUsername

add symlink to access mysql and mysqladmin
ln -s /usr/local/mysql/bin/mysql /usr/bin/mysql
ln -s /usr/local/mysql/bin/mysqladming /usr/bin/mysqladmin



info taken from:
http://dev.mysql.com/doc/refman/5.5/en/installing-source-distribution.html

Friday, October 18, 2013

Building Apache 2 and Php 5 with mysql support from source on Debian

following are the steps I used to build from source and install apache 2.2 and php 5.4 with mysql support on my debian system

i had to install additional packages from using apt:
libxml2-dev
libtool
autoconf


add specific user and group to run apache httpd as:
groupadd www-data
useradd -g www-data www-data 


download the Apache HTTP server from apache.org. become the root user and mv the downloaded tarball to /usr/local/src. unpack the apache tarball with:
tar -xvzf httpd-2_x_NN.tar.gz


download the PHP source from php.net. become the root user and move the downloaded tarball to /usr/local/src. unpack the PHP tarball with:
tar -xvzf php-NN.tar.gz


build and install Apache. reference the Apache install documentation for more details on building Apache.
cd httpd-2_x_NN
./configure --prefix=/usr/local/apache2 --with-included-apr 
    --enable-cgi --enable-cgid --enable-modules=all 
    --enable-mods-shared=all --enable-so 
    --enable-mime-magic --enable-deflate
make
make install


apache 2.2 is available at /usr/local/apache2. to test the installation use the normal procedure for starting the Apache server, e.g.:
/usr/local/apache2/bin/apachectl start
and stop the server to go on with the configuration for PHP:
/usr/local/apache2/bin/apachectl stop


configure and build PHP. configure with Apache 2 and MySQL support.
since apache was built from source, the steps below will match the path for apxs.
cd ../php-NN
./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql
make
make test
make install

setup your php.ini
cp php.ini-development /usr/local/lib/php.ini
edit your .ini file to set PHP options

verify/edit the apache httpd.conf to load the PHP module. make install from above may have already added this, but check.
LoadModule php5_module modules/libphp5.so


configure Apache to parse certain extensions as PHP. have Apache parse .php files as PHP.
 
    SetHandler application/x-httpd-php
 

to allow .php, .php2, .php3, .php4, .php5, .php6, and .phtml files to be executed as PHP use:

    SetHandler application/x-httpd-php

to allow .phps files to be handled by the php source filter, and displayed as syntax-highlighted source code, use:

    SetHandler application/x-httpd-php-source
 

other apache 2.2 httpd.conf configuration changes that I made:

changed the specific user and group to run httpd as
changed the document root
changed access configuration for different directories
changed errorlog
changed loglevel to debug
changed customlog path
changed scriptalias for cgi-bin
configured access for cgi-bin



use the normal procedure for starting the Apache server, e.g.:

/usr/local/apache2/bin/apachectl start


info taken from:
http://httpd.apache.org/docs/2.2/install.html
http://php.net/manual/en/install.unix.apache2.php

Wednesday, November 12, 2008

iceweasel not finding jre

i'm currently running debian etch. iceweasel is not finding the sun java jre that i installed using apt. i found the solution at http://xjqian.wordpress.com/2007/11/11/jre-plugin-for-mozilla/ .


after running

aptitude install sun-java6-jre

make a symbolic link

ln -s /usr/lib/jvm/java-6-sun/jre/plugin/i386/ns7/libjavaplugin_oji.so ~/.mozilla/plugins/libjavaplugin_oji.so

restart iceweasel.

success.

Thursday, November 8, 2007

Burn content to a DVD

use aptitude or apt-get to verify that you have dvd+rw-tools installed.

use the following command

growisofs -dvd-compat -input-charset=ISO-8859-1 -Z /dev/hda -R -J -pad "/my/directory/datas"


/dev/hda is the dvd burner device
/my/directory/datas is the path to the content to be burned

How to format a DVD-RW

use aptitude or apt-get to verify that you have dvd+rw-tools installed.

use the following command

dvd+rw-format -force /dev/hda

/dev/hda is the dvd burner device

Burn iso to a DVD from the Command Line

use aptitude or apt-get to verify that you have dvd+rw-tools installed.

use the following command

growisofs -dvd-compat -Z /dev/hda=/path/to/image.iso

/dev/hda is the dvd burner device
/path/to/image.iso is the iso file to burn

Tuesday, August 21, 2007

initial postgres login

i recently installed postgres 8.1 on my debian system using aptitude. following are the steps i used to create a new database or user.

1. su to super user
2. su to postgres user
3. create a new database or user

for more follow http://blog.revsys.com/2007/05/common_postgres.html

Tuesday, August 7, 2007

audio and usb on winxp vm in virtualbox

below is what i did on my debian box to get audio and usb to work on my winxp vm in virtualbox. i would expect this to work just fine on ubuntu also.


audio

open the innotek virtualbox program
choose the winxp vm and click the settings button for the vm
select audio in the left hand menu
select enable audio
select host audio driver to be ALSA audio driver


usb

execute the following command from the command line as root and add the following command to your /etc/rc.local file

chown -R root:vboxuers /proc/bus/usb


add to following line to the bottom of /etc/fstab

none /proc/bus/usb usbfs devgid=1003,devmode=666 0 0


then execute "mount -a" from the command line as root


start winxp vm

then put a usb thumb drive in a usb port and start a winxp vm in virtualbox
you should be able to here all the cool windows startup sounds ;^)
you should also be able to access any usb device

Tuesday, July 10, 2007

steps to compile a debian kernel

DebianKernelCompileSteps

These following steps to compile a Linux kernel for Debian are taken from steps published on the web by Falko Timme [at] falkotimme [dot] com. I modified his steps for grub. He originally used lilo.


Be aware that there is some risk in compiling your own kernel! For example, it could happen that your machine does not boot properly after you have installed the new kernel so you might be forced to boot from a rescue CD to repair your system. You have been warned! This document comes without warranty of any kind!



Prepare Your Current Machine


First login to your Debian machine on the command line as root. Install the prerequisites that we need to compile and run a new kernel. At the command line execute the following:

apt-get update
apt-get install kernel-package ncurses-dev fakeroot wget bzip2 module-init-tools initrd-tools procps

If you are asked the following question:

"If you really want to remove modutils type 'yes':"

type yes.

It might also be necessary to update packages like bind9, quota, etc. - depending on your configuration. If you have problems with your existing packages try to get the appropriate package from www.backports.org.



Get the Kernel Source


Then go to /usr/src:

cd /usr/src

Then get the latest Linux kernel source (or the kernel source you need) from http://www.kernel.org/pub/linux/kernel/v2.6/:

wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.8.1.tar.bz2



Unpack the kernel sources:


tar xjf linux-2.6.8.1.tar.bz2

cd linux-2.6.8.1/



Configure the Kernel


It is normally a good idea to take the configuration of your existing (working!) kernel 2.6 as a starting point for the configuration of your new kernel. Usually the current kernel configuration is saved in a file under /boot, e.g. /boot/config-2.6.3. We will load this configuration and then do the changes we desire.

make menuconfig

Select Load an Alternate Configuration File and enter the location of the configuration file of your current kernel (or upload my kernel configuration to your machine and enter its path):

The configuration of your current kernel will be loaded, and you can now browse through the menu and change the configuration to suit your needs. When you are finished, save your new kernel configuration:

Then run the following commands (please note that make dep is not needed any more for kernel 2.6):

make-kpkg clean
fakeroot make-kpkg --revision=custom.1.0 kernel_image


If the compilation stops with an error, run

make clean

and then re-run the previous commands starting with

make menuconfig

Change the kernel configuration where the error occurs. If no error occurs you will find the new kernel as a Debian package called kernel-image-2.6.8.1_custom.1.0_i386.deb under /usr/src.

cd ../



Install Your New Kernel


dpkg -i kernel-image-2.6.8.1_custom.1.0_i386.deb

Create a ramdisk of your new kernel (otherwise your system will most likely not boot):

cd /boot/
mkinitrd -o /boot/initrd.img-2.6.8.1 2.6.8.1



Edit Grub List


We are almost finished now. Edit the Grub stanza in /boot/grub/menu.list and add the line initrd /boot/initrd.img-2.6.8.1.

title Debian GNU/Linux, kernel 2.6.8.1
root (hd0,0)
kernel /boot/vmlinuz-2.6.8.1 root=/dev/hda1 ro
initrd /boot/initrd.img-2.6.8.1
savedefault

title Debian GNU/Linux, kernel 2.6.8.1 (single-user mode)
root (hd0,0)
kernel /boot/vmlinuz-2.6.8.1 root=/dev/hda1 ro single
initrd /boot/initrd.img-2.6.8.1
savedefault


Reboot Your Machine

reboot

and if everything is ok your machine should come up with the new kernel. You can run

uname -a

to verify that. Good luck!

faster debian booting

to speed up my debian booting, i have disabled the following services using the update-rc.d command:

postgresql
bittorrent
tomcat5
bluetooth
apache2
apache-perl

doing this should speed up my systems boot time and still give me access to these services when i choose to use them.

managing system services/daemons

on a debian system, the scripts to start and stop the system's services/daemons reside in /etc/init.d/ . For example, to stop the bittorrent service execute the following at the command line:

>/etc/init.d/bittorrent stop

to start the bittorrent service, execute the following at the command line:

>/etc/init.d/bittorrent start


what if the package apache2 is installed on my system, but i don't want that service to be started when the machine boots.

the command update-rc.d manages the links between the /etc/rc#.d directories and the scripts in the /etc/init.d directory. to enable a service on boot execute the following at the command line:

>update-rc.d "serviceName" defaults

to disable a service on boot execute the following at the command line:

>update-rc.d -f "serviceName" remove

Friday, June 29, 2007

restart services after update

how do i know which services need to be restarted after a system update? in the package debian-goodies is a program named checkrestart. run this program as root and it will print out the daemons that need to be restarted.