Tuesday, July 7, 2015

Personal linux debian command references (Debian command)

Note: these are command references for personal usage, you may use them as references freely with your own responsible. No warranty for any damages causing bay these references.

To show model

# dmidecode -s system-version
IdeaPad Gaming 3 15ARH7
16GB DDR5-4800 each slot manufacture tested

To show ram slot

# lshw -class memory

or

# dmidecode -t memory

Using ssh : remote to server using secure channel

$ ssh -l [user_name] [servername_or_ip]  

scp : upload to server using secure channel (secure copy) 

$ scp [file_source_to_upload] [user_name]@[servername_or_ip]:[full_path_destination_folder]

Using tar.gz 

To compress

$ tar -cvf [file_name.tar] [folder_to_archive]

To decompress from tar.gz

$ tar -xvf [file_name.tar]
$ tar -czvf BoyerMoore.tar.gz  ./BoyerMooreCopyPaste

Using p7zip

decompress

$ p7zip -d ./Kramaning.4.3.7z 

compress folder

$ 7z a kramaning.7z ./Kramaning/*

Restart lightdm xfce desktop server

# systemctl start lightdm
# systemctl status lightdm

User management

To Add user

# adduser user_id --home /home/user_id

To delete user and home directory

# deluser --remove-home user_id

To delete user and all related files and folders

# deluser --remove-all-files user_id

Disk Management

To show disk using lsblk

# lsblk
NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
nvme0n1     259:0    0 476.9G  0 disk
├─nvme0n1p1 259:1    0   260M  0 part /boot/efi
├─nvme0n1p2 259:2    0    16M  0 part
├─nvme0n1p3 259:3    0 162.2G  0 part
├─nvme0n1p4 259:4    0   166G  0 part
├─nvme0n1p5 259:5    0   9.8G  0 part
├─nvme0n1p6 259:6    0   7.5G  0 part [SWAP]
├─nvme0n1p7 259:7    0 129.3G  0 part /
└─nvme0n1p8 259:8    0     2G  0 part 

To show disk using idblk

# blkid
/dev/nvme0n1p7: UUID="df7ae6ac-f4ff-429e-9fb4-1a5f45e34f5e" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="94d61bfb-c413-4068-a231-89f12c26c343"
/dev/nvme0n1p5: LABEL="DATASHARE" UUID="A2FF-3F28" BLOCK_SIZE="512" TYPE="vfat" PARTLABEL="Basic data partition" PARTUUID="8be24844-0267-48c4-9c9c-0eb07b682984"
/dev/nvme0n1p3: LABEL="Windows-SSD" BLOCK_SIZE="512" UUID="9CB05AC3B05AA414" TYPE="ntfs" PARTLABEL="Basic data partition" PARTUUID="8996591a-1889-4be3-b932-11621d47ce94"
/dev/nvme0n1p1: LABEL_FATBOOT="SYSTEM_DRV" LABEL="SYSTEM_DRV" UUID="885A-5545" BLOCK_SIZE="512" TYPE="vfat" PARTLABEL="EFI system partition" PARTUUID="2ca7a85e-49bc-4ff5-8e2a-bf8d82f26ed9"
/dev/nvme0n1p8: LABEL="WINRE_DRV" BLOCK_SIZE="512" UUID="B0825B60825B29DC" TYPE="ntfs" PARTLABEL="Basic data partition" PARTUUID="0df86072-3532-4140-a733-79093411909c"
/dev/nvme0n1p6: UUID="7fef573b-5f9a-4c4e-a440-5c6cf459b965" TYPE="swap" PARTUUID="20da031c-ccd4-46d1-bc74-8c8f4dba0903"
/dev/nvme0n1p4: LABEL="mydata" BLOCK_SIZE="512" UUID="2698F69298F65FAB" TYPE="ntfs" PARTLABEL="Basic data partition" PARTUUID="13ee1824-6ae9-4982-ad57-68c55d6586b9"
/dev/nvme0n1p2: PARTLABEL="Microsoft reserved partition" PARTUUID="274d0d21-cb88-4b51-8a27-3290a4bee067"

To show disk using fdisk

# fdisk -l
Disk /dev/nvme0n1: 476.94 GiB, 512110190592 bytes, 1000215216 sectors
Disk model: Micron MTFDKCD512QFM-1BD1AABLA          
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 8CA19B9D-CFAB-4CC5-917E-96F2BD8BC30B

Device             Start        End   Sectors   Size Type
/dev/nvme0n1p1      2048     534527    532480   260M EFI System
/dev/nvme0n1p2    534528     567295     32768    16M Microsoft reserved
/dev/nvme0n1p3    567296  340758527 340191232 162.2G Microsoft basic data
/dev/nvme0n1p4 340758528  688916479 348157952   166G Microsoft basic data
/dev/nvme0n1p5 688916480  709396479  20480000   9.8G Microsoft basic data
/dev/nvme0n1p6 709398528  725022719  15624192   7.5G Linux swap
/dev/nvme0n1p7 725022720  996118527 271095808 129.3G Linux filesystem
/dev/nvme0n1p8 996118528 1000214527   4096000     2G Windows recovery environment

To show disk using parted

# parted -l
Model: Micron MTFDKCD512QFM-1BD1AABLA (nvme)
Disk /dev/nvme0n1: 512GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number  Start   End    Size    File system     Name                          Flags
 1      1049kB  274MB  273MB   fat32           EFI system partition          boot, esp
 2      274MB   290MB  16.8MB                  Microsoft reserved partition  msftres
 3      290MB   174GB  174GB   ntfs            Basic data partition          msftdata
 4      174GB   353GB  178GB   ntfs            Basic data partition          msftdata
 5      353GB   363GB  10.5GB  fat32           Basic data partition          msftdata
 6      363GB   371GB  8000MB  linux-swap(v1)                                swap
 7      371GB   510GB  139GB   ext4
 8      510GB   512GB  2097MB  ntfs            Basic data partition          hidden, diag, no_automount

To add user myuser to sudo group

# usermod -aG sudo myuser

To check myuser already in sudo group

# sudo -l -U myuser
Matching Defaults entries for myuser on mypc:
    env_reset, mail_badpass,
    secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin,
    use_pty

User myuser may run the following commands on mypc:
    (ALL : ALL) ALL

To Switch from Desktop to shell: ctrl + alt + f1

To Switch from shell to Desktop: ctrl + alt + f7

To see journal  systemd-module-load.service

# journalctl -b -u systemd-modules-load.service

To see temperature require lm-sensors

$ sensors
amdgpu-pci-0500
Adapter: PCI adapter
vddgfx:        1.46 V  
vddnb:       650.00 mV 
edge:         +40.0°C  
PPT:          21.18 W  
sclk:           2 GHz

MariaDB

to change journalctl mariadb to traditional log /var/log/mysql

create directory

# mkdir -m 2750 /var/log/mysql
# chown mysql /var/log/mysql

edit /etc/mysql/mariadb.conf.d/50-server.cnf , find or add


log_error = /var/log/mysql/error.log

test mariadb config, use user mysql (su mysql)

$ mysqld --validate-config 

Remove old rotate log in /var/log (for personal debian/not production server)

# ls boot.log.*
# rm boot.log.*

To check and restart apache2 

# apache2ctl configtest
# systemctl restart apache2


 

 



 


Install apt-cacher-ng

Server configuration and test
Install apt-cacher-ng
 # apt-get install apt-cacher-ng
Check your server using browser and enter URL 
http://localhost:3142/apt-cacher

Client configuration
Configure apt by creating a new file 01proxy at directory /etc/apt/apt.conf.d/ and add a line Acquire::http::Proxy "http://<IP address or hostname of the apt-cacher server>:3142";
For example, file /etc/apt/apt.conf.d/01proxy contain:
Acquire::http { Proxy "http://192.168.1.10:3142"; };

Installing Epson Inkjet L Series and M Series on Debian Wheezy

Download your printer driver from http://www.epson.co.id/sites/epson_indonesia/support/support.page and select suitable Distro.
Before you install the driver, install its dependency by running this:
# apt-get install lsb
After its completed, you can install your printer driver by running this:
# dpkg -i epson-inkjet-printer-201207w_1.0.0-1lsb3.2_amd64.deb 
For my case, I install L110 driver on Debian Wheezy.
Configure your Printer from your browser or from Applications -> System Tools -> Preferences -> System Settings -> Printers.
NOTE: Driver L100/L200 not compatible with Driver L110/L210 
For L100 use Epson Stylus NX115 (CUPS + Gutenprint v5.2.9) or
For L100/L200 use this driverhttp://download.ebz.epson.net/dsc/du/02/DriverDownloadInfo.do?LG2=PL&CN2=&DSCMI=24156&DSCCHK=95e99b2956fbf8c93b44cbd7a37f94836967528c

Debian 7.1 x64 installing firmware

Debian need firmware installed to make hardware can operated perfectly. During boot time, it informs the user that the system may required particular firmware installed. Here is the steps to install particular firmware:
  1. add this line into /etc/apt/sources.list
    # non free
    deb http://ftp.de.debian.org/debian wheezy main non-free
  2. run update by issuing
    # apt-get update
  3. list available firmware
    # aptitude search firmware
  4. install your firmware
    # apt-get install firmware-realtek  firmware-atheros

Installing Openerp 6.1 on Debian 7.1 x64 (old)

Follow these simple step to install and configure Openerp on Debian
1. update your debian
# apt-get update
# apt-get upgrade

2. install gedit
# apt-get install gedit
3. install postgresql 23.9M (version 9.1.9-1)
# apt-get install postgresql

optional install pgadmin3 if use desktop
# apt-get install pgadmin3
4. configure openerp user
# sudo su postgres
$ createuser openerp
as superuser n
create database y
create new roles y
$ psql -l
$ psql template1
# alter role openerp with password 'openerp';
quit from psql and back to root user (\q enter)
5. install python library
apt-get install python-dateutil python-feedparser python-gdata python-ldap \
    python-libxslt1 python-lxml python-mako python-openid python-psycopg2 \
    python-pybabel python-pychart python-pydot python-pyparsing python-reportlab \
    python-simplejson python-tz python-vatnumber python-vobject python-webdav \
    python-werkzeug python-xlwt python-yaml python-zsi


6. download packaged deb and install by issuing this
# dpkg -i openerp_6.1-latest-1_all.deb
it may take sometimes to install pyhton library required by openerp, wait until it finish.

7. edit file /etc/openerp/openerp-server.conf (password in stap 4)
db_password = openerp

8. run openerp service by issuing
# service openerp start

# service openerp restart

9. run openerp client using browser http://localhost:8069

Note:
Default Installation located at
  • /usr/lib/pymodules/python2.7/openerp/
  • /usr/share/pyshared/openerp

  • /usr/lib/pymodules/python2.7/openerp/addons
  • /usr/share/pyshared/openerp/html_view