Tuesday, 10 September 2013

Ubuntu Linux

0) To change samba4 password

sudo samba-tool user  setpassword <username>

The system will prompt you for entering the password.

1) During configure command, sometimes we meet this error:

No package 'libusb-1.0' found

This is what we need to do to find out the actual packages to be installed.

LinuxBox:~$ apt-cache search libusb-1.0
libusb-1.0-0 - userspace USB programming library
libusb-1.0-0-dev - userspace USB programming library development files
libfprint-dev - async fingerprint library of fprint project, development headers
libfprint0 - async fingerprint library of fprint project, shared libraries
libpam-fprint - PAM module allowing authentication via fprint
libusb-ocaml - OCaml bindings to libusb-1.0 (runtime)
libusb-ocaml-dev - OCaml bindings to libusb-1.0

Then, install the missing packages.

LinuxBox:~$ apt-get install libusb-1.0-0

2) During make, sometimes we see this error:

cannot stat .deps/***.Tpo
No such file or directory

Then, run autoreconf to update the generated configuration files.

autoreconf
configure
make

3) Drop MySQL tables in databases matching some wildcard:

Using the shell command to do this:

mysql -u root -pkeyasic -D medical -e "show tables" -s | 
  egrep "^Whoever_" | 
  xargs -I "@@" echo mysql -u root -pkeyasic -D medical -e "DROP TABLE @@"

Explanation:

First part, output a list of your tables
mysql -u root -pkeyasic -D medical -e "show tables" -s 

Second part, searches for any lines that begins with the word "Whoever_"
egrep "^Whoever_"

Third part, will take each line from second part, and inserts it instead of the @@ in the DROP TABLE command.
xargs -I "@@" echo mysql -u root -pkeyasic -D medical -e "DROP TABLE @@"

To actually execute the command, remove the echo in the command.

4) Ask Make process to show full commands:

to execute and print the commands, run:
# make V=1

to print the full commands without executing them, run:
# make -n

5) Linux Apache MySQL PHP (LAMP) Server setup in Ubuntu

a) Install Apache Http Server

Download the source code, then build it.

When configuring it, you may need to get some APR libraries.
sudo apt-get install libapr1-dev
sudo apt-get install libaprutil1-dev

Then you build it.
./configure --prefix=/usr/local
make
sudo make install

Your apache binary is in /use/local/bin because of the prefix.

Your apache httpd.conf is in /usr/local/conf as well. Check the DocumentRoot setting, such as
/usr/local/htdocs

To restart Apache httpd:
sudo httpd -k restart

Alternatively, install the Apache Ubuntu binary:
sudo apt-get install apache2

Then, restart apache2:

 sudo service apache2 restart

The conf file is in /etc/apache2/apache2.conf.
The htdocs is in /var/www folder.

b) Install MySQL Server

sudo apt-get install mysql-server

After you make changes to /etc/mysql/my.cnf, you can restart MySQL
sudo service mysql restart

c) Install PHP5

Install the apache2 mod php5 library:
sudo apt-get install libapache2-mod-php5

Then, create a symbolic link /etc/apache2/mods-enabled/php5.xxx pointing to 


/etc/apache2/mods-availble/php5.xxx
sudo a2enmod php5

Then, install php5:
sudo apt-get install php5


d) Install MySQL and PHP binding


sudo apt-get install libapache2-mod-auth-mysql php5-mysql


Shortcut:




In Ubuntu 12.04, we can do the LAMP in a single step. Firstly, get the tasksel:
$ sudo apt-get install tasksel 



Then, install the lamp-server, which includes everything we need for LAMP.
sudo tasksel install lamp-server

No comments:

Post a Comment