Category Archives: Ubuntu

Postgres on ubuntu

1) Switch to postgres
$ sudo -i -u postgres
2) Create a db
$ createdb mydatabase
3) Import pk file to db
$ psql mydatabase < /home/user/Desktop/mydatabase.pk
4) Switch to mydatabase db from postgres
$ psql mydatabase
5) Export a table data to csv format
$ COPY customer_billing TO ‘/tmp/customer_billinginfo’ DELIMITER ‘,’ CSV HEADER;
Note: The following command are in sequence, should be executed one after another.

Downgrade Mysql 5.7 to 5.6 in Ubuntu from terminal

first ssh to the remote system via command:
remove 5.7
———-
sudo apt-get remove --purge mysql-server mysql-client mysql-common
sudo apt-get remove --purge mysql*
sudo apt-get remove --purge mysql-apt-config
sudo apt-get autoremove

After these steps I installed again everything solved the problem. ( not necessary though )

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


Installing mysql 5.6
--------------------
apt-get install mysql-server-5.6
Configuring users in mysql
——————————–
mysql -u root -p
CREATE USER ‘fitset’@’localhost’ IDENTIFIED BY ‘volleyball2013’;
CREATE USER 'myuser'@'%' IDENTIFIED BY 'mypass';

then,

GRANT ALL ON *.* TO 'myuser'@'localhost';
GRANT ALL ON *.* TO 'myuser'@'%';

and finally,

FLUSH PRIVILEGES; 
EXIT;

Installing font in linux

#!/usr/bin/bash
wget http://www.nba.org.np/Misc/Preeti_0.ttf
mkdir /usr/share/fonts/myfonts
mv Preeti_0.ttf /usr/share/fonts/myfonts/
fc-cache -f -v

Remove / purge php and install php 7.0 and 5.* in same machine linux ubuntu 16.04

First of all remove php
———————————–
This should completely remove any package which name starts with php and anything related to it.
sudo apt-get -y purge php.*


Now next step ref: http://tecadmin.net/install-php5-on-ubuntu/#

Install PHP 5.6

Use the following set of command that adds PPA for PHP 5.6 in your system to install PHP 5.6.

 

$ sudo apt-get install python-software-properties
$ sudo add-apt-repository ppa:ondrej/php
$ sudo apt-get update
$ sudo apt-get install -y php5.6

 

Install PHP 5.5

Use the following set of command to add PPA for PHP 5.5 in your Ubuntu system and install PHP 5.5.

$ sudo apt-get install python-software-properties
$ sudo add-apt-repository ppa:ondrej/php
$ sudo apt-get update
$ sudo apt-get install -y php5.5

Copyright © 2020. Powered by WordPress & Romangie Theme.