Home » 2019 » July

Monthly Archives: July 2019

Linux related tutorials

First link of useful tutorials.
An Indian guy did a good job by putting up pretty basic tutorial, but it is very useful.

Freelance Data Scientists

I am collecting how many “freelance data scientists” out there. Wow, here they are:

kolabtree pops up as the first link on google search

Get the system set up — CentOS7

Scenario 1. Install Python3 on my CentOS7

CentOS7 comes with python (2.7.5), but I need python3, the installation note is recorded here.

I used the Digital Ocean in the past, it shows an old note for installation. But, it needs payment information now, therefore, I have to skip it.

Installing python3 on centos7
 1000  sudo yum -y update 
 1001  sudo yum -y install yum-utils
 1002  sudo yum -y groupinstall development
 1003  sudo yum -y install https://centos7.iuscommunity.org/ius-release.rpm

However, it seems that Python group has version 3.7.4
I ended up using help here to install python3.7.4

Since I am installing on the user’s level, I used “sudo”

 1005  sudo yum install gcc openssl-devel bzip2-devel libffi-devel 
 1010  cd /usr/src
 1014  wget https://www.python.org/ftp/python/3.7.4/Python-3.7.4.tgz
 1015  sudo wget https://www.python.org/ftp/python/3.7.4/Python-3.7.4.tgz
 1016  sudo tar xzf Python-3.7.4.tgz 
 1017  cd Python-3.7.4
 1018  sudo ./configure --enable-opimizations
 1019  sudo make altinstall
 1020  sudo rm /usr/src/Python-3.7.4.tgz 
 1021  python3.7 -V

Wow, it turns out that I have python3.6 installed. Now, I have two python3. I create a symbolic link to python3.7 anyway.

bash-4.2$ pwd 
/usr/bin
bash-4.2$ ls -al python*
lrwxrwxrwx. 1 root root     7 Jul 11 18:08 python -> python2
lrwxrwxrwx. 1 root root     9 Jul 11 18:08 python2 -> python2.7
-rwxr-xr-x. 1 root root  7216 Jun 20 16:28 python2.7
lrwxrwxrwx. 1 root root     9 Jul 31 11:03 python3 -> python3.6
lrwxrwxrwx. 1 root root    18 Jul 31 11:03 python36 -> /usr/bin/python3.6
-rwxr-xr-x. 2 root root 11408 Apr 25 17:05 python3.6
-rwxr-xr-x. 2 root root 11408 Apr 25 17:05 python3.6m
lrwxrwxrwx. 1 root root    24 Jul 31 13:24 python3.7 -> /usr/local/bin/python3.7

Lastly, I followed the instruction and get an python virtual environment set up

bash-4.2$ pwd 
/ddn/gs1/home/li11/pythonProject
mkdir pythonWVenv/my_project_venv/
cd 
python3.6 -m my_project_venv
bash-4.2$ ls pythonWVenv/my_project_venv/
bin  include  lib  lib64  pip-selfcheck.json  pyvenv.cfg  share
source pythonWVenv/my_project_venv/bin/activate
(my_project_venv) bash-4.2$ python -V
Python 3.6.3

Now, I create a new python environment with python3.7

bash-4.2$ pwd
/ddn/gs1/home/li11/pythonProject/pythonWVenv

bash-4.2$ mkdir PyVenv37 
bash-4.2$ python3.7 -m venv PyVenv37 
bash-4.2$ source PyVenv37/bin/activate 
(PyVenv37) bash-4.2$ python -V
Python 3.7.4
(PyVenv37) bash-4.2$ 

Scenario 2. Install PyCharm on my CentOS7

It seems quite simple, plus there is an Indian guy who makes a video on the installation.. A few steps would be enough

Download the PyCharm Community version from the jetbean portal. 
Unzip the tarball and test the executable
Put it in /bin/path
Configure a virtual python environment within Pycharm render much convenience for programming.

Scenario 3. Install vlc on my CentOS7

I need to run mp4 video, and it turns out vlc is the commonly used media player. Therefore, I need to install it on my CentOS7. Following this help or this link, it seems simple. But, it does not work for me for the following error.

 Finished Dependency Resolution
Error: Package: vlc-core-2.1.6-2.el6.nux.x86_64 (nux-dextop)
           Requires: libmatroska.so.4()(64bit)
Error: Package: vlc-core-2.1.6-2.el6.nux.x86_64 (nux-dextop)
           Requires: libdvbpsi.so.9()(64bit)
Error: Package: ffmpeg-libs-2.6.8-3.el6.nux.x86_64 (nux-dextop)
           Requires: libgnutls.so.26(GNUTLS_1_4)(64bit)
Error: Package: vlc-core-2.1.6-2.el6.nux.x86_64 (nux-dextop)
           Requires: libebml.so.3()(64bit)
Error: Package: ffmpeg-libs-2.6.8-3.el6.nux.x86_64 (nux-dextop)
           Requires: libgnutls.so.26()(64bit)
Error: Package: vlc-core-2.1.6-2.el6.nux.x86_64 (nux-dextop)
           Requires: libudev.so.0()(64bit)
Error: Package: ffmpeg-libs-2.6.8-3.el6.nux.x86_64 (nux-dextop)
           Requires: libopenjpeg.so.2()(64bit)
Error: Package: faac-1.28-2.el6.nux.x86_64 (nux-dextop)
           Requires: libmp4v2.so.0()(64bit)
Error: Package: vlc-core-2.1.6-2.el6.nux.x86_64 (nux-dextop)
           Requires: libmtp.so.8()(64bit)
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest

I used google search hopefully to get all the dependencies that it misses, with a hope to make vlc work.

Scenario 4: Mount a network drive

This is my workstation, I need to mount a network drive for my linux at NIEHS

Install package: fuse-sshfs
sudo sshfs -o allow_other li11@scigate:/ddn/gs1/home/li11 ~/ddnDrive/

Or, to unmount:
sudo umount -f /Users/plummie/Documents/stanford

Scenario 5: Working with Docker

I have a separate page on how to work with Docker under CentOS7.

Scenario 6: When I connect my laptop to the ethernet, it needs special editing work

There is a good post that I follow, and it works!

	
  • Type “nmcli d” command in your terminal for quick identification of Ethernet cards installed in your machine.
  • Type this command “nmtui” to open Network manager
  • Follow the prompt and add ethernet interface
  • Issue " systemctl restart network
  • When prompt for admin password.
  • Scenario 7: install R/Rstudio

    Following the online doc or the documentation from Rstudio directly.

    sudo yum install epel-release
    sudo yum install R
    wget https://download1.rstudio.org/rstudio-1.1.419-x86_64.rpm 
    yum install rstudio-1.1.419-x86_64.rpm 
    Launch a browser and go to http://localhost:8787/
    

    There has been new release of Rstudio server for CentOS 6/7 and 8 separately.

    wget https://download2.rstudio.org/server/centos6/x86_64/rstudio-server-rhel-1.2.5033-x86_64.rpm
    sudo yum install rstudio-server-rhel-1.2.5033-x86_64.rpm
    

    To check whether Rstudio is working:

    systemctl status rstudio-server.service
    sudo rstudio-server verify-installation
    

    Mine installation has a glitch as the “admin” account was confused, therefore I had to ask our SysAdmin to help.

    I tested the sudo and it worked perfectly fine. However, there is one 
    application, which needs the sudo to install, but it fails to accept 
    my “admin credential”. I suspect that it gets confused which “log in” 
    it needs to take. When you get a chance, could you please swing by 
    or I can come to your desk? I hope it will be an easy fix for you.
    

    He gets it sorted out

    Got rstudio sorted out.  It authenticates using PAM, but it uses 
    its own PAM module which doesn’t really work properly out of the box.  
    I moved over a modified copy of the standard module we use and you 
    should be able to login now.  Please check and let me know.