Category Archives: Configuration

X server and related managers

See also
# nice explanation about the entire startx workflow
# explanation about sessions

# list available desktop environments
ls -l /usr/share/xsessions
# show current login manager
cat /etc/X11/default-display-manager
# see also lightdm-greeter from Alternatives Configurator:
ls -l /usr/share/xgreeters
# how to restore Unity login greeter
cat /etc/lightdm/lightdm.conf
greeter-session=unity-greeter -> add this line

# check the available session managers with
update-alternatives --list x-session-manager
# or get a more verbose description indicating which one is default with
update-alternatives --display x-session-manager
# shows the link to the default session manager
ls -l /etc/alternatives/x-session-manager
# change the default session manager by running
update-alternatives --config x-session-manager

# list available window managers
update-alternatives --list x-window-manager
# shows the link to the default window manager
ls -l /etc/alternatives/x-window-manager

# list of available session types
ls -l /usr/share/xsessions
# see also ~/.dmrc for the current default selected session type
cat ~/.dmrc
# see also user defaults with
cat /var/lib/AccountsService/users/$USER

q: what to put in .xsession (e.g. for xrdp)?
a: pick from update-alternatives --list x-session-manager
warn: some of them won't work (something related to 3D graphics)
worked for me: xfce4-session, lxsession, mate-session, startlxde, openbox-session

# Zorin OS theme
sudo add-apt-repository ppa:noobslab/themes
sudo apt-get update
sudo apt-get install windos-10-themes

# 9 Great XFCE Themes
# Ambiance theme for XFCE (with xfwm4)
Current XFCE theme:
grep -nr ThemeName .config/xfce4
When Settings -> Appearance doesn't open try running it from command line:

# change xfce desktop icon background/shadow
# see /usr/share/doc/xfdesktop4/README
# my ~/.gtkrc-2.0.mine
style "xfdesktop-icon-view" {
    XfdesktopIconView::label-alpha = 1

    fg[NORMAL] = "#ffffff"
    fg[SELECTED] = "#ffffff"
    fg[ACTIVE] = "#ffff00"
widget_class "*XfdesktopIconView*" style "xfdesktop-icon-view"

Transmission on Ubuntu

Important files
/etc/init.d/transmission-daemon -> SysV service
/etc/default/transmission-daemon -> run by /etc/init.d/transmission-daemon
/********/.config/transmission-daemon -> CONFIG_DIR in /etc/default/transmission-daemon

User and Group running transmission-daemon
change to desired ones (e.g. USER=************) in /etc/init.d/transmission-daemon

Boost or at least unlock the website’s performance

### configure /etc/sysctl.conf:
# Uncomment the next line to enable TCP/IP SYN cookies
# See
# Note: This may impact IPv6 TCP sessions too
fs.file-max = 6815744
# The maximum number of queued connection requests which have still not received an acknowledgement from the connecting client.
net.ipv4.tcp_max_syn_backlog = 65535
# Maximum number  of  packets,  queued  on  the  INPUT  side, when the interface receives packets faster than kernel can process them.
# for 1G NIC:
net.core.netdev_max_backlog = 3000

### limits (/etc/security/limits.conf)
# see current user limits:
ulimit -a
# see process limits (e.g. pid 1660):
cat /proc/1660/limits

### systemd service
# configure http server's "max number of open files" limit (soft and hard):

### debug your website's performance:
tailf apps/log/nginx-error.log
# watch for "too many open files" problem:
tailf /var/log/syslog | grep SNMP
# watch the main log for other possible problems:
tailf /var/log/syslog
# your application server logs:
tailf ~/apps/opt/apache-tomcat-7.0.64/logs/catalina.out
# see (roughly) how many sockets are open:
watch --interval=1 'netstat -tuna | wc -l'
# or using lsof to count the list of open files:
watch --interval=1 'lsof | wc -l'
# use apache benchmarking tool:
ab -c 1000 -n 10000 -s 80 -H 'Accept-Encoding: gzip' -qd https://yourhost/yourwebsite > nginx1k-10k-ssl.txt

### Conclusion (jetty as application server):
http with nginx (+gzip) in front of jetty is 44% slower comparing to jetty direct access.
https with nginx (+gzip) in front of jetty is 2x faster comparing to jetty direct access.

### test with tomcat with Tomcat Native Library:
# text/plain:
curl -i
# text/plain:
curl -i
# application/json:
curl -i
# application/json, get all ORDER BY sql:
curl -i
# application/json, get all ORDER BY sql:
curl -i
# application/json, search by indexed string column sql:
curl -i

rm -v adr*.txt tom*.txt ng-tom*.txt ngs-tom*.txt ngs-gz*.txt
grep -P "Failed|Requests|Document Length|Request rate|Reply status" adr*.txt tom*.txt ng-tom*.txt ngs-tom*.txt ngs-gz*.txt
# -H 'Accept-Encoding: gzip'

## tomcat:
# RAM text/plain
ab -c 3500 -n 35000 -s 360 -qdr > tom-testRAMString-3,5k.txt
# RAM text/plain deferred
ab -c 2300 -n 23000 -s 360 -qdr > tom-testRAMStringDeferred-2,3k.txt

# RAM application/json
ab -c 3000 -n 30000 -s 360 -qdr > tom-testRAMObjectToJson-3k.txt
# RAM application/json deferred
ab -c 1900 -n 19000 -s 360 -qdr > tom-testRAMObjectToJsonDeferred-1,9k.txt

# sql: get all ORDER BY
ab -c 675 -n 6750 -s 360 -qdr > tom-testGetNoCacheableOrderedAppConfigs-675.txt

# sql: search by indexed string column
ab -c 800 -n 8000 -s 360 -qdr > tom-testGetNoCacheableAppConfigByName-800.txt

## nginx -> tomcat:
# RAM text/plain
ab -c 2250 -n 22500 -s 360 -qdr > ng-tom-testRAMString-2,25k.txt
# RAM text/plain deferred
ab -c 1400 -n 14000 -s 360 -qdr > ng-tom-testRAMStringDeferred-1,4k.txt

# RAM application/json
ab -c 1975 -n 19750 -s 360 -qdr > ng-tom-testRAMObjectToJson-1,975k.txt
# RAM application/json deferred
ab -c 1450 -n 14500 -s 360 -qdr > ng-tom-testRAMObjectToJsonDeferred-1,45k.txt

# sql: get all ORDER BY
ab -c 625 -n 6250 -s 360 -qdr > ng-tom-testGetNoCacheableOrderedAppConfigs-625.txt

# sql: search by indexed string column
ab -c 710 -n 7100 -s 360 -qdr > ng-tom-testGetNoCacheableAppConfigByName-710.txt

## tomcat (ssl):
# RAM text/plain
ab -c 90 -n 900 -s 360 -qdr > toms-testRAMString-90.txt

# RAM application/json
ab -c 90 -n 900 -s 360 -qdr > toms-testRAMObjectToJson-90.txt

# sql: get all ORDER BY
ab -c 90 -n 900 -s 360 -qdr > toms-testGetNoCacheableOrderedAppConfigs-90.txt

# sql: search by indexed string column
ab -c 90 -n 900 -s 360 -qdr > toms-testGetNoCacheableAppConfigByName-90.txt

## nginx -> tomcat (ssl):
# RAM text/plain
ab -c 550 -n 5500 -s 360 -qdr > ngs-tom-testRAMString-550.txt

# RAM application/json
ab -c 550 -n 5500 -s 360 -qdr > ngs-tom-testRAMObjectToJson-550.txt

# sql: get all ORDER BY
ab -c 410 -n 4100 -s 360 -qdr > ngs-tom-testGetNoCacheableOrderedAppConfigs-410.txt

# sql: search by indexed string column
ab -c 450 -n 4500 -s 360 -qdr > ngs-tom-testGetNoCacheableAppConfigByName-450.txt

## nginx (gzip) -> tomcat (ssl):
# RAM text/plain
ab -c 560 -n 5600 -s 360 -qdr -H 'Accept-Encoding: gzip' > ngs-gz-tom-testRAMString-560.txt

# RAM application/json
ab -c 560 -n 5600 -s 360 -qdr -H 'Accept-Encoding: gzip' > ngs-gz-tom-testRAMObjectToJson-560.txt

# sql: get all ORDER BY
ab -c 405 -n 4050 -s 360 -qdr -H 'Accept-Encoding: gzip' > ngs-gz-tom-testGetNoCacheableOrderedAppConfigs-405.txt

# sql: search by indexed string column
ab -c 445 -n 4450 -s 360 -qdr -H 'Accept-Encoding: gzip' > ngs-gz-tom-testGetNoCacheableAppConfigByName-445.txt

## nginx
ab -c 625 -n 6250 -s 360 -qdr > ngs-625.txt
ab -c 4600 -n 40000 -s 360 -qdr > ngs-4600.txt


# when already have mysql do:
sudo systemctl start mysql

sudo apt-get install zoneminder
sudo chmod +r /etc/zm/zm.conf
sudo chmod g+rw /etc/php/7.0/apache2/php.ini

# edit /etc/php/7.0/apache2/php.ini
date.timezone = Europe/Bucharest

# create mysql user zmuser/zmpass and mysql schema zm
# grant all privileges for zm schema to zmuser
mysql -u zmuser -p < /usr/share/zoneminder/db/zm_create.sql

sudo a2enconf zoneminder.conf
sudo a2enmod cgi
sudo systemctl restart apache2

# access

gitweb on apache

# projects web page will be:
# Create a git project (e.g. testproject.git):
# mkdir -p /opt/GITRepositories/testproject.git
# cd /opt/GITRepositories/testproject.git
# git init --bare --shared
# cp -v /opt/GITRepositories/test.git/hooks/post-update.sample /opt/GITRepositories/test.git/hooks/post-update
# now is ready for cloning:
# git clone

# cat /etc/httpd/conf.d/git.conf
SetEnv GIT_PROJECT_ROOT /opt/GITRepositories

<LocationMatch "^/[^/]+\.git(/.*)">
	AuthType Basic
	AuthName "Git Access"
	AuthUserFile "/opt/GITRepositories/committers.txt"
	Require valid-user
	# Require group committers

AliasMatch ^/([^/]+\.git)/(objects/[0-9a-f]{2}/[0-9a-f]{38})$			/opt/GITRepositories/$1/$2
AliasMatch ^/([^/]+\.git)/(objects/pack/pack-[0-9a-f]{40}.(pack|idx))$	/opt/GITRepositories/$1/$2
ScriptAliasMatch \
		"(?x)^/([^/]+\.git/(HEAD | \
						info/refs | \
						objects/(info/[^/]+ | \
								[0-9a-f]{2}/[0-9a-f]{38} | \
								pack/pack-[0-9a-f]{40}\.(pack|idx)) | \
						git-(upload|receive)-pack))$" \

# ScriptAlias /gitweb	/var/www/git/gitweb.cgi
Alias /gitweb /var/www/git
<Directory /var/www/git>
	AuthType Basic
	AuthName "Git Access"
	AuthUserFile "/opt/GITRepositories/committers.txt"
	Require valid-user

	Options +ExecCGI
	AddHandler cgi-script .cgi
	DirectoryIndex gitweb.cgi

# grep -i -P "^[^#]" /etc/gitweb.conf 
$projects_list_description_width = "50";
$projectroot = "/opt/GITRepositories";
$home_link_str = "projects";
$base_url = "";
@git_base_url_list = qw(
see also Basic authentication password creation

gitweb on nginx

nginx configuration

# Let Nginx handle static files # location ~ ^.*\.git/objects/([0-9a-f]+/[0-9a-f]+|pack/pack-[0-9a-f]+.(pack|idx)) { location ~ ^/[^/]*\.git/objects/([0-9a-f]+/[0-9a-f]+|pack/pack-[0-9a-f]+.(pack|idx)) { auth_basic "strong authentication"; auth_basic_user_file /********/apps/etc/basic.auth.strong.passwords.txt; root /********/GITRepoUbuntu/; } # Pass Git Smart HTTP requests to git-http-backend. Require Auth for everything. # see man git-http-backend for Apache configuration #location ~ ^.*\.git/(HEAD|info/refs|objects/info/.*|git-(upload|receive)-pack)$ { location ~ ^/[^/]*\.git/(HEAD|info/refs|objects/info/.*|git-(upload|receive)-pack)$ { auth_basic "strong authentication"; auth_basic_user_file /********/apps/etc/basic.auth.strong.passwords.txt; client_max_body_size 0; fastcgi_read_timeout 300; fastcgi_buffers 4 64K; include fastcgi_params; fastcgi_pass unix:/var/run/fastcgi.sock; fastcgi_param SCRIPT_FILENAME /usr/lib/git-core/git-http-backend; fastcgi_param GIT_PROJECT_ROOT /********/GITRepoUbuntu; fastcgi_param PATH_INFO $uri; fastcgi_param REMOTE_USER $remote_user; ### Uncomment below to export ALL repositories in GIT_PROJECT_ROOT path. fastcgi_param GIT_HTTP_EXPORT_ALL ""; } location /git/ { auth_basic "strong authentication"; auth_basic_user_file /********/apps/etc/basic.auth.strong.passwords.txt; try_files $uri @gitweb; } location @gitweb { fastcgi_pass unix:/var/run/fastcgi.sock; fastcgi_param SCRIPT_FILENAME /usr/share/gitweb/gitweb.cgi; fastcgi_param PATH_INFO $uri; fastcgi_param GITWEB_CONFIG /etc/gitweb.conf; include fastcgi_params; } # sudo systemctl status nginx fcgiwrap.service fcgiwrap.socket # sudo systemctl enable nginx fcgiwrap.service fcgiwrap.socket # sudo systemctl stop nginx fcgiwrap.service fcgiwrap.socket # sudo systemctl start fcgiwrap.socket fcgiwrap.service nginx


#see man gitweb # path to git projects (.git) $projectroot = "/********/GITRepoUbuntu/"; # directory to use for temp files # $git_temp = "/tmp"; # html text to include at home page # $home_text = "indextext.html"; # file with project list; by default, simply scan the projectroot dir. # $projects_list = "/home/git/projects.list"; @stylesheets = ("gitweb.css"); $javascript = "gitweb.js"; $favicon = "git-favicon.png"; $logo = "git-logo.png"; # git-diff-tree(1) options to use for generated patches @diff_opts = ('-C', '-C'); # enable nicer uris # $feature{pathinfo}{default} = [1]; $site_name = "adrhc's projects"; $home_link = ""; $home_link_str = "adrhc's projects"; $mimetypes_file = "/********/apps/etc/nginx/mime.types"; $base_url = ""; @git_base_url_list = qw(; @extra_breadcrumbs = ( [ "adrhc's blog" => "" ] );


[Unit] Description=fcgiwrap Socket [Socket] SocketMode=0660 SocketUser**** SocketGroup********* ListenStream=/var/run/fastcgi.sock [Install]


[Unit] Description=Simple CGI Server [Service] # # sudo apt-get install fcgiwrap # systemctl daemon-reload # sudo systemctl enable fcgiwrap.socket fcgiwrap.service ExecStartPre=/bin/mkdir -p /var/cache/cgit ExecStartPre=/bin/chown ************ /var/cache/cgit #ExecStartPre=/bin/rm -rf /var/cache/cgit/* ExecStart=/usr/sbin/fcgiwrap User**** Group********* [Install] Also=fcgiwrap.socket

example bare repository config

cat /********/GITRepoUbuntu/test/git/config [core] repositoryformatversion = 0 filemode = false bare = true sharedrepository = 1 [receive] denyNonFastforwards = true [alias] st = status gr = log --full-history --all --graph --color --date-order --pretty=format:"%x1b[31m%h%x09%x1b[32m%d%x1b[0m%x20%s" ci = commit cim = commit -m ck = checkout ckm = checkout master ckd = checkout dev rs = reset mgnf = merge --no-ff mg = merge pom = push origin master pod = push origin development gom = pull origin master god = pull origin development [gitg] mainline = refs/heads/master # ERROR git clone edit some files then commit ... git push origin master Counting objects: 3, done. Delta compression using up to 4 threads. Compressing objects: 100% (3/3), done. Writing objects: 100% (3/3), 303 bytes | 0 bytes/s, done. Total 3 (delta 2), reused 0 (delta 0) remote: error: unable to create temporary file: Operation not permitted remote: fatal: failed to write object error: unpack failed: unpack-objects abnormal exit To ! [remote rejected] master -> master (unpacker error) error: failed to push some refs to '' # SOLUTION Make sure the user and group (and SocketMode) set for fcgiwrap OS service are appropriate for the git repository (when using http/https push).

Ubuntu and Oracle

# see also
# see also

# Follow this (works with Ubuntu 16.04 too):

# systemd oracle.service (working when only one db is automatically started with /etc/oratab)
Description=Oracle 12c






ExecStart=/u01/app/oracle/product/12.1.0/dbhome_1/bin/dbstart /u01/app/oracle/product/12.1.0/dbhome_1
ExecStop=/u01/app/oracle/product/12.1.0/dbhome_1/bin/dbshut /u01/app/oracle/product/12.1.0/dbhome_1


# modify dbstart and dbshut in order to create /run/oracle/ needed by oracle.service
# /u01/app/oracle/product/12.1.0/dbhome_1/bin/dbstart
startinst() {
      if [ $? -eq 0 ] ; then
        echo "" 
		OS_PID=$(sqlplus -S / AS SYSDBA <<EOF
select SPID from v\$process where PNAME = 'PMON';
		OS_PID=$(echo "$OS_PID" | /bin/grep -P "\d+")
        echo "$0: ${INST} \"${ORACLE_SID}\" warm started (PID $OS_PID)." 
		if [ -d /run/oracle ]; then
			echo "$OS_PID" > /run/oracle/
			echo "created /run/oracle/"
        $LOGMSG "" 
        $LOGMSG "Error: ${INST} \"${ORACLE_SID}\" NOT started." 
# /u01/app/oracle/product/12.1.0/dbhome_1/bin/dbshut
  if test $? -eq 0 ; then
	if [ -f /run/oracle/ ]; then
		# see /u01/app/oracle/product/12.1.0/dbhome_1/bin/dbstart
		rm -fv /run/oracle/
    echo "${INST} \"${ORACLE_SID}\" shut down."
    echo "${INST} \"${ORACLE_SID}\" not shut down."

CentOS and Oracle


# rsync -cEhikLmrtz --progress --delete-after KIT/Oracle/linuxamd64_12102_database_se2_* root@
# scp KIT/Oracle/linuxamd64_12102_database_se2_* root@

# run as root ...
groupadd oinstall
groupadd dba
useradd -g oinstall -G dba oracle
passwd oracle

# For Intel N3150 CPU I changed the original "kernel.shmmax = 1987162112" like below.
echo "# oracle kernel parameters
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 4093800448
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048586" >> /etc/sysctl.conf

# Check and apply the oracle kernel parameters:
# -p Load in sysctl settings from the file specified or /etc/sysctl.conf if none given. 
#    Specifying - as filename means reading data from standard input.
# -a Display all values currently available.
sysctl -p
sysctl -a

# Specify limits for oracle user in the /etc/security/limits.conf
echo "# limits for oracle user
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536" >> /etc/security/limits.conf

yum install -y zip unzip
unzip KIT/ -d /stage/
unzip KIT/ -d /stage/
chown -R oracle:oinstall /stage/

# Create /u01 directory for Oracle software and /u02 for database files.
mkdir /u01
mkdir /u02
chown -R oracle:oinstall /u01
chown -R oracle:oinstall /u02
chmod -R 775 /u01
chmod -R 775 /u02
chmod g+s /u01
chmod g+s /u02

# Check required packages are installed:
yum list binutils.x86_64 compat-libcap1.x86_64 gcc.x86_64 gcc-c++.x86_64 glibc.i686 glibc.x86_64 glibc-devel.i686 glibc-devel.x86_64 ksh compat-libstdc++-33 libaio.i686 libaio.x86_64 libaio-devel.i686 libaio-devel.x86_64 libgcc.i686 libgcc.x86_64 libstdc++.i686 libstdc++.x86_64 libstdc++-devel.i686 libstdc++-devel.x86_64 libXi.i686 libXi.x86_64 libXtst.i686 libXtst.x86_64 make.x86_64 sysstat.x86_64

# Install missing required packages:
yum install -y binutils.x86_64 compat-libcap1.x86_64 gcc.x86_64 gcc-c++.x86_64 glibc.i686 glibc.x86_64 glibc-devel.i686 glibc-devel.x86_64 ksh compat-libstdc++-33 libaio.i686 libaio.x86_64 libaio-devel.i686 libaio-devel.x86_64 libgcc.i686 libgcc.x86_64 libstdc++.i686 libstdc++.x86_64 libstdc++-devel.i686 libstdc++-devel.x86_64 libXi.i686 libXi.x86_64 libXtst.i686 libXtst.x86_64 make.x86_64 sysstat.x86_64

# Also install the "X Window System" package group (already included with GNOME, KDE, MATE, XFCE, Cinnamon).
yum groupinstall -y "X Window System"

# the only one working (after second boot) with CentOS on VMWare 12.1.0 on ASRock with Intel N3150
# login with oracle user created above
sudo yum -y groups install "MATE Desktop"
echo "exec /usr/bin/mate-session" > ~/.xinitrc
# open a command prompt with oracle user and run:

# see Oracle Installer Screens at

# Firewall (run as root)
firewall-cmd --get-active-zones
firewall-cmd --zone=public --add-port=1521/tcp --add-port=5500/tcp --add-port=5520/tcp --add-port=3938/tcp --permanent
firewall-cmd --reload
firewall-cmd --list-ports

# Oracle Environment
# Login as oracle user and add the following values to the /home/oracle/.bash_profile
ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/12.1.0/dbhome_1; export ORACLE_HOME
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib:/usr/lib64; export LD_LIBRARY_PATH
# Reload the bash_profile to apply the new settings:
. .bash_profile

# Login to the database
sqlplus system@orcl

# Manage database with Oracle Enterprise Manager:

Mount DAV directory

# see
# see -> for cq character
# see

# edit /etc/updatedb.conf:
# PRUNEFS="... davfs davfs2"

adrhcbImpl() {
	# sudo mkdir -p /mnt/adrhc
	# sudo chmod g+rw /mnt/adrhc
	# sudo chmod u+s /sbin/mount.davfs
	# sudo usermod -aG users user1
	# openssl s_client -connect -showcerts /dev/null | openssl x509 -outform PEM > /home/user1/.davfs2/certs/
	# in ~/.davfs2/secrets:
	# /mnt/adrhc-dav user1 "password" -> the enclosing character " is mandatory to use for the password or see special characters in
	# later, when ~/.davfs2/davfs2.conf is automatically created change to:
	# trust_ca_cert	  /home/user1/.davfs2/certs/
	# use_locks       0
	# same change do it in /etc/davfs2/davfs2.conf
	# with /etc/fstab:
	#   /mnt/adrhc-davshare   davfs   rw,users,async,noauto   0   0
	#   /mnt/adrhc-davsharep   davfs   rw,users,async,noauto   0   0
	#   /mnt/adrhc-win   davfs   rw,users,async,noauto   0   0
	#   /mnt/adrhc-linux   davfs   rw,users,async,noauto   0   0
	# the use mount command:
	# mount /mnt/adrhc-dav
	# without fstab:
	# sudo mount -t davfs /mnt/adrhc-linux -o ro,uid=user1,gid=user1,noexec	
	# if [ "`mount | grep /mnt/adrhc`" != "" ]; then
	# 	echo "/mnt/adrhc already mounted"
	# 	return
	# fi
	# sshfs /mnt/adrhc
	# echo "/mnt/adrhc mounted"

	if [ "`mount | grep /mnt/adrhc-dav`" != "" ]; then
		echo "/mnt/adrhc-dav already mounted"
	mount /mnt/adrhc-dav
	if [ "$?" == 0 ]; then
		echo "/mnt/adrhc-dav mounted"
		echo "/mnt/adrhc-dav NOT mounted"

Make ubuntu or applications run faster

See also

Check ubuntu startup times
systemd-analyze blame


mount | grep -P "^tmpfs.+/(tmp|var/run)"
sudo du -sh /tmp /var/tmp; du -sh /********/apps/tmp /********/apps/var/run /run/user/`id -u` /tmp/tomcat 2>/dev/null
tmpfs /tmp tmpfs defaults,relatime,mode=1777,size=4G 0 0
tmpfs /var/tmp tmpfs defaults,relatime,mode=1777,size=99G 0 0
tmpfs /********/apps/tmp tmpfs defaults,relatime,mode=1777,size=2G 0 0
tmpfs /********/apps/run tmpfs rw,nosuid,noexec,relatime,mode=755,size=2G 0 0

Firefox cache
see also
see also

Main disadvantages of this method are that the content of currently browsed web pages is lost if browser 
crashes or after a reboot, and that the settings need to be configured for each user individually.

Open the url: about:config.
browser.cache.disk.enable false
browser.cache.disk.capacity 512000 -> 500M
browser.cache.memory.max_entry_size 512000 -> 500M appcache
browser.cache.memory.enable true
browser.cache.memory.capacity 1048576 -> 1G RAM
See the result in about:cache?device=memory (might require a firefox restart).

Increase the Speed at Which Firefox loads pages
see also
see also

1. Type “about:config” into the address bar and hit Enter.
(Normally the browser will make one request to a web page at a time. When you enable pipelining it will make several at once, which really speeds up page loading.)

2. Alter the entries as follows:
Set “network.http.pipelining” to “true”
Set "network.http.pipelining.ssl” to “true”
see also network.http.proxy.pipelining
network.http.pipelining.maxrequests -> default 32; modified to 6
content.notify.ontimer -> created with value true (default anyway)
content.notify.backoffcount -> created with value 3 (default -1)
content.notify.interval -> default 120 000 microseconds; modified to 500 000

Chromium cache
see also
see also the cache chrome://cache/ -> takes an age to load ...
Allocate Chromium 1G of disk cache by modifying in any chromium-browser.desktop (Exec=chromium-browser lines):
chromium-browser --disk-cache-size=1073741824 --disk-cache-dir=/var/tmp/chromium-cache ...
see also

Improve chrome performance
Navigate to chrome://flags and chrome://gpu/.
See video card info at

Enable these in chrome://flags/:
Enable experimental canvas features
Override software rendering list - canceled
Number of raster threads - 4
Enable GPU rasterization
Enable zero-copy rasterizer
Simple Cache for HTTP
Disable touch adjustment
Enable TCP Fast Open
LCD text antialiasing
Enable Download Resumption

Disable these in chrome://flags/:
Enable touch events
Enable pinch scale

Startup parameters:
grep "Exec=" /usr/share/applications/chromium-browser.desktop
grep "Exec=" $HOME/.local/share/applications/chromium-browser.desktop
Exec=chromium-browser --process-per-site --disk-cache-size=1073741824 --disk-cache-dir=/var/tmp/chromium-cache --enable-native-gpu-memory-buffers %U
Exec=chromium-browser --process-per-site --disk-cache-size=1073741824 --disk-cache-dir=/var/tmp/chromium-cache --enable-native-gpu-memory-buffers
Exec=chromium-browser --process-per-site --disk-cache-size=1073741824 --disk-cache-dir=/var/tmp/chromium-cache --enable-native-gpu-memory-buffers --incognito
Exec=chromium-browser --process-per-site --disk-cache-size=1073741824 --disk-cache-dir=/var/tmp/chromium-cache --enable-native-gpu-memory-buffers --temp-profile

Firefox & Chromium profile
see also
see also
see also
sudo add-apt-repository ppa:graysky/utils
sudo apt-get update
sudo apt-get install profile-sync-daemon
psd p -> creates /********/.config/psd/psd.conf
Primary configuration:
gedit /********/.config/psd/psd.conf
USERS="gigi bob"
Add to /etc/sudoers (required by psd.service USE_OVERLAYFS="yes"):
gigi ALL=(ALL) NOPASSWD: /usr/bin/psd-overlay-helper
secondary configuration
mkdir -p ~/.config/systemd/user/psd-resync.timer.d
gedit ~/.config/systemd/user/psd-resync.timer.d/frequency.conf
Description=Timer for Profile-sync-daemon
Enable & start the service:
systemctl --user enable /usr/lib/systemd/user/psd.service
systemctl --user start psd
systemctl --user status psd
Stop & disable the service:
systemctl --user stop psd
systemctl --user disable psd
Check psd installation & configuration:
profile-sync-daemon parse
psd p
ls -l ~/.mozilla/firefox/
ls -l /run/user/`id -u`

Server -> Transcoder: /var/tmp/plex-transcoding

Linux hdd defragmentation
see also

HDD performance
see also
see also
see also

hdd performance info
echo "queue_depth: $(cat /sys/block/sda/device/queue_depth)"; echo "nr_requests: $(cat /sys/block/sda/queue/nr_requests)"; echo "read_ahead_kb: $(cat /sys/block/sda/queue/read_ahead_kb)"
echo "queue_depth: $(cat /sys/block/sdb/device/queue_depth)"; echo "nr_requests: $(cat /sys/block/sdb/queue/nr_requests)"; echo "read_ahead_kb: $(cat /sys/block/sdb/queue/read_ahead_kb)"

Queue_depth (default 31)
cat /sys/block/sda/device/queue_depth
cat /sys/block/sdb/device/queue_depth

I/O scheduler queue size (default 128)
How many requests may be allocated in the block layer for read or write requests.
cat /sys/block/sda/queue/nr_requests
su	-> won't work using sudo ...
echo 1024 > /sys/block/sda/queue/nr_requests
cat /sys/block/sdb/queue/nr_requests
echo 1024 > /sys/block/sdb/queue/nr_requests

Maximum number of kilobytes to read-ahead
cat /sys/block/sda/queue/read_ahead_kb	-> default 128
cat /sys/block/sdb/queue/read_ahead_kb

Print readahead in 512-byte sectors (
sudo blockdev --getra /dev/sda		-> default 256 (always double to read_ahead_kb above)
sudo blockdev --getra /dev/sdb

This file (/sys/block/sda/queue/add_random) allows to turn off the disk entropy contribution. Default value of this file is '1'(on).
cat /sys/block/sdb/queue/nr_requests
su	-> won't work using sudo ...
echo 1 > /sys/block/sdb/queue/nr_requests

Persist using /etc/rc.local
blockdev --setra 256 /dev/sda
echo 1 > /sys/block/sda/queue/add_random

Disable IPv6 support
Check ipv6 status (1 = disabled)
cat /proc/sys/net/ipv6/conf/all/disable_ipv6

Add to /etc/sysctl.conf

Disable loading of ivp6 module into kernel during booting
see also
Edit /etc/modprobe.d/blacklist.conf
blacklist ipv6

This option controls the tendency of the kernel to reclaim the memory which is used for caching of directory and inode objects.
At the default value of vfs_cache_pressure=100 the kernel will attempt to reclaim dentries and inodes at a "fair" rate with respect to pagecache and swapcache reclaim. Decreasing vfs_cache_pressure causes the kernel to prefer to retain dentry and inode caches. When vfs_cache_pressure=0, the kernel will never reclaim dentries and inodes due to memory pressure and this can easily lead to out-of-memory conditions. Increasing vfs_cache_pressure beyond 100 causes the kernel to prefer to reclaim dentries and inodes.

IBM WebSphere 6.1 on Ubuntu

1. install java 1.5 from oracle
2. start WAS install: 
	cd /********/Downloads/
	/********/apps/opt/java/jdk1.5.0_22/bin/java -jar setup.jar
3. WAS install window should start ...

export JAVA_HOME=/********/apps/opt/java/jdk1.5.0_22
export PATH="/********/apps/opt/java/jdk1.5.0_22/bin:$PATH"
cd /********/apps/opt/WebSphere/AppServer/bin
mv /********/apps/opt/WebSphere/AppServer/java/bin/java /********/apps/opt/WebSphere/AppServer/java/bin/java1
ln -s $JAVA_HOME/bin/java /********/apps/opt/WebSphere/AppServer/java/bin/java
./ help -> this should work now!

Ubuntu XRDP (remote desktop from windows)

Consider ubuntu xrdp error problem connecting 5910 solution:
tightvncserver MUST be installed before xrdp!!!

sudo apt-get install xfce4
sudo apt-get install tightvncserver
sudo apt-get install xrdp
sudo usermod -aG xrdp adr

configure XRDP (option 1)
cat ~/.xsession
echo 'xfce4-session' > ~/.xsession (when having XFCE or xubuntu desktop)
echo 'mate-session' > ~/.xsession (when having MATE desktop)
echo 'startlxde' > ~/.xsession (when having LXDE or lubuntu desktop)
or use 'lxsession -s Lubuntu -e LXDE' or 'lxsession -s Lubuntu-Netbook -e LXDE' instead of 'startlxde'

configure XRDP (option 2)
In /etc/xrdp/ replace the line ". /etc/X11/Xsession":
sudo sed -i s/"^\. \/etc\/X11\/Xsession"/"#\. \/etc\/X11\/Xsession\nstartxfce4"/ /etc/xrdp/
sudo sed -i s/"^\. \/etc\/X11\/Xsession"/"#\. \/etc\/X11\/Xsession\nmate-session"/ /etc/xrdp/
sudo sed -i s/"^\. \/etc\/X11\/Xsession"/"#\. \/etc\/X11\/Xsession\nstartlxde"/ /etc/xrdp/
or use 'lxsession -s Lubuntu -e LXDE' or 'lxsession -s Lubuntu-Netbook -e LXDE' instead of 'startlxde'

configure XRDP for PATH and .profile problem
Change in /etc/xrdp/
# see
. /etc/environment
. ~/.profile

start xrdp
sudo systemctl restart xrdp
See the log file:
tail -f /var/log/xrdp-sesman.log

login from windows
When logging with windows RDC first you'll get an error message. Press ok in the error's message window then you'll be asked (using a linux-style window) for the user and password. Fill the required fields (the ones already filled in RDC) then press ok and that's it.

See also
inspired by:

Ubuntu swap & ram

gksudo gedit /etc/sysctl.conf
#append or modify (if already exists) the following:
#0 .. 100 (0 = no swap)

# swap info
swapon -s
cat /proc/swaps
vmstat 1
systemctl list-units --type=swap
systemctl list-units | grep \.swap
# clear swap cache
sudo swapoff -a
sudo swapon -a

# comment swap lines in /etc/fstab and stop & mask them with systemd:
sudo systemctl status dev-sda3.swap
sudo systemctl stop dev-sda3.swap
# or stop and disable the swap:
sudo systemctl --now mask dev-sda3.swap