Ubuntu 管理心得

搜尋此網誌

2019年3月25日 星期一

Copy drupal from kpchiaoi5 to kpci7

In kpchiai5:
  1. mysqldump -u drupaladmin -h localhost --skip-lock-tables -p drupal > drupal_20160826_kpchiaoi5.sql
  2. gzip -9 drupal_20160826_kpchiaoi5.sql
  3. sudo tar zcvf public_html_drupal_20160826_kpchiaoi5.tgz public_html/drupal

In kpci5:
  1. download from kpchiaoi5: drupal_20160826_kpchiaoi5.sql.gz, public_html_drupal_20160826_kpchiaoi5.tgz
  2. gzip -dc drupal_20160826_kpchiaoi5.sql.gz | sed -e '/^UNLOCK/d' -e '/^LOCK/d' > ~/a.sql
  3. Using phpmyadmin to drop all drupal tables.
  4. mysql -u drupaladmin -p drupal < ~/a.sql
  5. sudo tar zxvfp public_html_drupal_20160826_kpchiaoi5.tgz -C /home/chiao
  6. sudo chown -R www-data.www-data /home/chiao/public_html/drupal (IMPORTANT!!!!)
  7. 6. 設定 -> 開發 -> 效能 -> 清除所有快取

2019年3月24日 星期日

For drupal having “htaccess: Options not allowed here” error

Edit /etc/apache2/mods-available/userdir.conf, add Options in AllowOveride, namely,

AllowOverride FileInfo AuthConfig Limit Indexes Options

2019年3月15日 星期五

Prevent dash on the repeated author for IEEE bibliography

The following might not be work. Try my another blog:

https://kpchiaoo.blogspot.com/2019/07/bibtex-citation-with-author-for.html
  1. Put the following line inside bib file, @IEEEtranBSTCTL{IEEEexample:nodash,CTLdash_repeated_names = "no"}
  2. Put the TeX ERT inside lyx file contains
    \bstctlcite{IEEEexample:nodash}
  3. Make sure "nodash" in both files are the same
  4. Or edit IEEEtrans.bst, change # 1 to #0 as follows:
    % #0 turns off the "dashification" of repeated (i.e., identical to those
    % of the previous entry) names. The IEEE normally does this.
    % #1 enables
    FUNCTION {default.is.dash.repeated.names} { #1 }

2019年3月3日 星期日

icon too big in nautilus

dconf-editor->org->gnome->nautilus->icon-view->default-zoom-level

2019年3月2日 星期六

disable baloo

In user shell, rather than root or sudo:

balooctl status
balooctl disable

2019年3月1日 星期五

ssh without password

Let Client be A, and Server be B.
Then inisde A, run this line: ssh-keygen -t rsa
Press Enter 2 or 3 times. Then copy/append the contents in id_rsa.pub to B:$HOME/.ssh/authorized_keys2

Done!

2019年2月22日 星期五

build krusader

  1. sudo apt-get build-dep krusader
  2. git clone http://anongit.kde.org/krusader
  3. mkdir MyKrusader
  4. cd MyKrusader
  5. cmake .. -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_C_FLAGS="-O2 -fPIC" -DCMAKE_CXX_FLAGS="-O2 -fPIC" 
  6. (NB, step 5 has .. )
  7. make
  8. sudo make install

2019年2月18日 星期一

wake on lan WOL windows 10

In control panel, uncheck the  快速啟動 option


setup HP-LaserJet PRo M15W

  1. Download latest driver from:  https://sourceforge.net/projects/hplip/files/hplip/
    e.g. hplip-3.19.1.run (as of 20190218)
  2. sudo hplip-3.19.1.run
  3.  Done!

2019年1月30日 星期三

IEEE keyword

Inside LaTeX box: \begin{IEEEkeywords}

My keyword 1, My keyword 2, My keyword  3... 
Inside LaTeX box: \end{IEEEkeywords}

2019年1月25日 星期五

Increase row height

Put this into LaTeX box (Ctrl-L) in front of table:
\setlength\extrarowheight{5pt} Or \renewcommand{\arraystretch}{1.5}
If the above not work, try add vphantom inside the table cell, e.g.
\vphantom{{ \displaystyle {\frac{1}{5}} }}
 
 


2019年1月24日 星期四

dash style

cf: /home/chiao/Fuzzy/Papers/2019/0623FUZZ-IEEE/papers/example/Matplotlib/exm.ipynb

#[8, 4, 6, 2] means: 8pt. line + 4pt. break + 6pt. line + 2pt. break ]
dstary=[[1,0],[8, 2],[5, 2], [3,2], [1,2]]
ax.plot(x, yL,label=labl,linewidth=2, dashes=dstary[1], color='black')

2019年1月3日 星期四

Plot several functions with differenet domains

Show[Plot[0.025` Sqrt[3156 - 1800 x + 225 x^2], {x, 5.4048, 6}],
 Plot[0.5339, {x, 6, 11}],
 Plot[\[Sqrt](30.091788404703134` - 4.696813600723558` x +
     0.18064667695090608` x^2), {x, 11, 11.4437}], PlotRange -> All]

2018年10月14日 星期日

Training plan to Google calendar

  1. Make a csv file, like this:
    Subject,Start Date,Start Time,End Date,End Time,All Day Event
    Tempo 7km,2018/10/16,05:10:00 PM,2018/10/16,06:10:00 PM,False
    Tempo 13km,2018/10/17,04:30:00 PM,2018/10/17,06:30:00 PM,False
  2.  Login to Google Calendar
  3. Click the three vertial dots at the right of calendar -> 設定與共用
  4. On the next page, click the 匯入與匯出 on the top left panel
  5. Select the import file, e.g  google_calendar_template.csv
  6. 新增至日曆,e.g. 路跑比賽
  7. Then click 匯入
  8. Done.


2018年10月1日 星期一

dropbox icon not showing

cf: https://askubuntu.com/questions/1029225/how-to-fix-broken-nautilus-dropbox-icon-in-ubuntu-18-04-gnome-flashback-in-top-p

  1. dropbox stop
  2. gedit ~/.config/autostart/dropbox.desktop
    replace Exec=dropbox start -i with
    Exec=env XDG_CURRENT_DESKTOP=Unity dropbox start
  3. sudo gedit /usr/share/applications/dropbox.desktop
    replace Exec=dropbox start -i with
    Exec=env XDG_CURRENT_DESKTOP=Unity dropbox start
  4. click Dropbox in dash to start it.
  5. Done.

2018年9月27日 星期四

update drupal (for kpci7 drupal 8.9.x)

# update drupal
sudo drush -r /home/chiao/public_html/drupal ups

#Put the site into maintenance mode before updating using:
sudo drush -r /home/chiao/public_html/drupal sset system.maintenance_mode 1
sudo drush -r /home/chiao/public_html/drupal cr

#Execute the updates:
sudo drush -r /home/chiao/public_html/drupal up drupal

#Apply any required database and entity updates:
sudo drush -r /home/chiao/public_html/drupal updb
sudo drush -r /home/chiao/public_html/drupal entup
sudo drush -r /home/chiao/public_html/drupal sset system.maintenance_mode 0
sudo drush -r /home/chiao/public_html/drupal cr
Done!

Install drush with composer

Cf: https://www.drupal.org/docs/8/update/update-procedure-in-drupal-8
# Install composer using apt-get:
sudo apt-get install composer

# Install latest drush (e.g. 9.x) using composer (2018-4-4) (not recommanded!)
# composer global require drush/drush

# Or, just install drush 8 using composer (2018-4-4)
# because drush 9.x cannot use ups (recommanded)
composer global require drush/drush:~8

# create symbolic link
sudo ln -s /home/chiao/.composer/vendor/bin/drush /usr/local/bin
or
sudo ln -s /home/chiao/.config/composer/vendor/bin/drush /usr/local/bin

#cd ~/.config/composer
# make sure php-curl installed
sudo apt-get install php-curl -y

2018年9月14日 星期五

設定編輯 xfig "於外部編輯檔案"

  1. 工具 -> 偏好設定 -> 檔案處理 -> 檔案格式
  2. 點選格式tab中的 FIG
  3. 編輯器(i): 自訂 /usr/bin/xfig

2018年9月6日 星期四

Create a new text file on desktop

cf: https://askubuntu.com/questions/936587/how-to-add-right-click-on-desktop-to-create-text-file-functionality-16-04-2-ub

Create a blank text file (you can create any type of file, not just text), e.g. my.txt, in ~/模板 (~/Templates). Then in the right click menu under New document (on desktop) it will appear an item "my.txt".

2018年8月29日 星期三

setup gmail relay

cf: https://www.howtoforge.com/tutorial/configure-postfix-to-use-gmail-as-a-mail-relay/#debian-ubuntu
  1. edit /etc/postfix/sasl_passwd, add this line
    [smtp.gmail.com]:587 username@gmail.com:password 
  2. chmod 0400 /etc/postfix/sasl_passwd, 
  3. vi /etc/postfix/main.cf, add these lines:
    #relayhost = (uncomment this line)
    # chiao
    relayhost = [smtp.gmail.com]:587
    smtp_sasl_auth_enable = yes
    smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
    smtp_sasl_security_options =
    smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt
    smtp_use_tls = yes 
  4. postmap /etc/postfix/sasl_passwd 
  5. service postfix restart

2018年8月12日 星期日

xfig bad screen text fonts

If xfig screen fonts are bad, e.g.
then it needs do this:
sudo apt install gsfonts-x11
logout then login.
After installing gsfonts-x11, the xfig screen will look like this

2018年8月11日 星期六

Octave produce blank fig (xfig) file in ubuntu 18.04

I have a post in http://octave.1599824.n4.nabble.com/Cannot-produce-fig-file-td4687972.html#a4688009.

The reason why fig cannot be created is due to the bug in ghostscript 9.22.  
I found a solution (temporarily) in ubuntu 18.04. The steps are:
  1. Download the ghostscript 9.23  here
  2. Untar it at, say, /foo/.
  3. sudo mv /usr/bin/gs /usr/bin/gs_orig_922
  4. sudo ln -sf /download/Ghostscript/ghostscript-9.23-linux-x86_64/gs-923-linux-x86_64 /usr/bin/gs
  5. Done!

2018年8月8日 星期三

Convert vmdk for using in ESXi

The vmdk file, e.g, created in vmware workstation, cannot be directlt used in ESXi. It needs to be converted. The process is:
  1. Enable ssh connection in ESXi host.
  2. ssh to ESXi host, e.g. ssh -l root 192.168.1.110
  3. cd to the directory containing the vmdk file, e.g.
    cd /vmfs/volumes/62169753-c96da716/vmdk
  4. Suppose the vmdk file is ubuntu.vmdk, and let the converted vmdk filename be ubuntu_convert.vmdk. Then issue the command,
    vmkfstools -i ubuntu.vmdk ubuntu_convert.vmdk -d thin
  5. It will show something like:
    ...
    Clone: 100% done.
    It does not mean thee conversion is really finished. Just wait until the shell returns prompt, e.g. [root@chiao-dell:/vmfs/volumes/62169753-c96da716/vmdk]
  6. Usually, it will take couple of hours to finish for large file, YES! H.O.U.R.S. !
  7. If the datastore in on an nfs server, e.g. 192.168.1.8, then get into the nfs directory and use the following command to display the converted file size.
    ls -lsh ubunut_convert-flat.vmdk
    You will see something like this line:
    2.0G -rw------- 1 myuid mygid 510G  8月  8 16:27 ubuntu_convert-flat.vmdk
    Keep running this command, the size at the front is increasing. 

2018年8月6日 星期一

Delete backup files with tilde ~ suffix

Delete all backup files in pwd and sub-directories:

find ./ -name "*~" -delete
confirm to delete,
find ./ -name "*~" -ok rm {} \;


2018年8月5日 星期日

Prevent dash on the repeated author for IEEE bibliography-1

設定如下圖:
輸出如下圖:

complie lyx

sudo apt-get build-dep lyx
cd /download1/LyX/lyx-2.3.0
./configure --enable-qt5
make
make install

網誌存檔