pages tagged linux http://meng6net.localhost/tag/linux/ <p><small>Copyright © 2005-2020 by <code>Meng Lu &lt;lumeng3@gmail.com&gt;</code></small></p> Meng Lu's home page ikiwiki Tue, 21 Jan 2020 22:00:35 +0000 Installing and configuring Python on Ubuntu Linux http://meng6net.localhost/computing/installing_and_configuring/installing_and_configuring_Python_on_Ubuntu_Linux/ http://meng6net.localhost/computing/installing_and_configuring/installing_and_configuring_Python_on_Ubuntu_Linux/ Linux Python computing configuration documentation installation note software Tue, 16 May 2017 23:59:39 +0000 2017-05-16T23:59:39Z <h2>Install system packages</h2> <pre> <code>sudo apt-get install gfortran libopenblas-base libopenblas-dev libzmq3-dev sudo apt-get install python-qt4 python-zmq </code></pre> <p>The following shew up as dependencies when I tried to install <code>matplotlib</code> in a virtual environment using <code>pip install matplotlib</code>:</p> <pre><code>sudo apt-get install libfreetype6-dev libpng12-dev </code></pre> <h2>Install Python</h2> <pre> <code>sudo apt-get install python python-pip python-dev build-essentials sudo apt-get install python3 python3-pip </code></pre> <h2>Install IPython</h2> <pre><code>sudo apt-get install ipython python-notebook </code></pre> <p>To install IPython with Python 3 [<sup id="fnref:1"><a href= "http://meng6net.localhost/tag/linux/#fn:1" rel="footnote">1</a></sup>]:</p> <pre><code>sudo apt-get install ipython3 python3-notebook </code></pre> <h2>Install Python packages</h2> <h3>Use Ubuntu's package management system <code>apt-get</code>:</h3> <pre><code>sudo apt-get install python-matplotlib sudo apt-get install virtualenv vurtualenvwrapper </code></pre> <h3>Use Python package management system <code>pip</code>:</h3> <pre><code>pip install "ipython[all]" pip install virtualenv pip install virtualenvwrapper pip install numpy pip install scipy pip install matplotlib pip install pyzmq pip install pygments </code></pre> <h2>Use Anaconda Python distribution and its package management and environment management</h2> <p>This part is same on macOS or Ubuntu Linux. See <a href= "http://meng6net.localhost/computing/installing_and_configuring/installing_and_configuring_Python_on_macOS/"> installing and configuring Python on macOS</a>.</p> <h2>Other packages</h2> <h3>GraphLab, a machine-learning package</h3> <p>This part is same on macOS or Ubuntu Linux. See <a href= "http://meng6net.localhost/computing/installing_and_configuring/installing_and_configuring_Python_on_macOS/"> installing and configuring Python on macOS</a>.</p> <h2>References</h2> <div class="footnotes"> <hr /> <ol> <li id="fn:1"> <p>It used to be that <code>ipython</code> has to be installed via <code>pip3</code>, but I think this has been superseded by the above as of Ubuntu 15.10 and Mar. 2016 at least:</p> <p>pip3 install ipython</p> <a href="http://meng6net.localhost/tag/linux/#fnref:1" rev="footnote">↩</a></li> </ol> </div> Installing and configuring Git http://meng6net.localhost/computing/installing_and_configuring/installing_and_configuring_git/ http://meng6net.localhost/computing/installing_and_configuring/installing_and_configuring_git/ computing configuration documentation installation linux note software tip ubuntu Tue, 16 May 2017 23:59:39 +0000 2020-01-21T22:00:35Z <h2>Configure <code>.gitignore</code></h2> <pre><code># use glob syntax syntax: glob # specific files tempfile # back up files .DS_Store ._* *~ .nfs.* #*# *.bak *.old # logs derby.log #derby db lift_example # eclipse conf file #.settings #.classpath #.project .manager # building target build null tmp* temp* dist test-output # Java *.class # other scm .svn .CVS .hg* # use regexp syntax syntax: regexp #^\.pc/ </code></pre> <h2>Installing more recent Git in Ubuntu 12 than its repositories standardly offer</h2> <pre> <code>sudo apt-get install software-properties-common python-software-properties sudo add-apt-repository ppa:git-core/ppa sudo apt-get update sudo apt-get install git </code></pre> <p>Alternatively install the other Git-related packages:</p> <pre> <code>sudo apt-get install git-daemon-run git-daemon-sysvinit git-el git-email git-gui gitk gitweb git-arch git-cvs git-mediawiki </code></pre> <ul> <li>References: <ul> <li><a href= "https://launchpad.net/~git-core/+archive/ubuntu/ppa">https://launchpad.net/~git-core/+archive/ubuntu/ppa</a></li> <li><a href= "https://help.ubuntu.com/community/Repositories/Ubuntu">https://help.ubuntu.com/community/Repositories/Ubuntu</a></li> </ul> </li> </ul> <h2><code>help.autoCorrect</code></h2> <p>There is an auto-correction feature in Git which can be turned on by:</p> <pre><code>git config --global help.autoCorrect 15 </code></pre> <p>See a terminal session recording: https://showterm.io/189e7798324029948ac3c</p> <p>I think this is a potentially dangerous feature to use (at least for production purposes) with limited benefit. I decided to not use it. In fact, it's better to set <code>git config --global help.autocorrect 0</code> to indicate this configuration preference explicitly.</p> <h2><code>.git/config</code></h2> <p>Example <code>.git/config</code> file that sets multiple remote repositories. Note the instances of <code>XXX</code> do not ALWAYS represent the same string that need to be replaced by your real-world information.</p> <pre><code>[core] repositoryformatversion = 0 filemode = true bare = false logallrefupdates = true ignorecase = true [remote "origin"] url = https://XXX@github.com/XXX/XXX.git pushurl = https://XXX@github.com/XXX/XXX.git pushurl = git@gitlab.com-XXX:XXX/XXX.git pushurl = git@bitbucket.org-XXX:XXX/XXX.git fetch = +refs/heads/*:refs/remotes/origin/* [remote "bitbucket"] url = git@bitbucket.org-XXX:XXX/XXX.git fetch = +refs/heads/*:refs/remotes/bitbucket/* [remote "gitlab"] url = git@gitlab.com-XXX:XXX/XXX.git fetch = +refs/heads/*:refs/remotes/gitlab/* [branch "master"] remote = origin merge = refs/heads/master [user] name = XXX XXX email = XXX@XXX.com # END </code></pre> Installing and configuring Java on Linux http://meng6net.localhost/computing/installing_and_configuring/installing_and_configuring_java_on_Ubuntu_Linux/ http://meng6net.localhost/computing/installing_and_configuring/installing_and_configuring_java_on_Ubuntu_Linux/ computing configuration documentation draft installation java linux note software tutorial ubuntu Tue, 16 May 2017 23:59:39 +0000 2017-05-16T23:59:39Z <p>This is a note on my experience of installing Java on Ubuntu Linux 14.04.</p> <p>The default Java packages on Ubuntu Linux <code>openjdk-7-jdk</code> is from OpenJDK. It should be more or less consistent with <a href= "http://docs.oracle.com/javase/specs/">Java Language and Virtual Machine Specifications</a>. However, on macOS computers, I use Oracle's JDKs for developing Java programs, and some softwares I use such as Android Studio warns that using OpenJDK can be problematic and recommends using Oracle's JDK instead. Therefore, I install Oracle's Java as a standard component on my Linux computers as well. Oracle calls it "Java Platform (JDK) Platform". JDK is Java Development Kit which is the software package one needs to do Java software development. It's currently at version "Java SE 7" and is updated to "JDK SE 8" in March 2014.</p> <h2>Installing Oracle JDK 7 using ppa</h2> <p>Install dependency:</p> <pre><code>sudo apt-get install python-software-properties </code></pre> <p>Install Oracle JDK using Webup8.org's PPA:</p> <pre><code>sudo add-apt-repository ppa:webupd8team/java sudo apt-get update sudo apt-get install oracle-java7-installer # or if you want JDK 8: # sudo apt-get install oracle-java8-installer </code></pre> <p>At command line verify <code>java</code> is pointing to Oracle JDK 7,</p> <pre><code>$ which java /usr/bin/java $ ls -la /usr/bin/java lrwxrwxrwx 1 root 22 Jan 24 07:16 /usr/bin/java -&gt; /etc/alternatives/java* $ ls -la /etc/alternatives/java lrwxrwxrwx 1 root 39 Jul 8 12:04 /etc/alternatives/java -&gt; /usr/lib/jvm/java-7-oracle/jre/bin/java* </code></pre> <h2>Installing Oracle JDK 8</h2> <pre><code>$ sudo apt-get install oracle-java8-installer </code></pre> <h2>Choosing default Java</h2> <p>Choose Java 7 as the default for <code>java</code> and <code>javac</code>:</p> <pre><code>$ java -version java version "1.8.0_45" Java(TM) SE Runtime Environment (build 1.8.0_45-b14) Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode) $ sudo update-alternatives --config java There are 3 choices for the alternative java (providing /usr/bin/java). Selection Path Priority Status ------------------------------------------------------------ * 0 /usr/lib/jvm/java-8-oracle/jre/bin/java 1073 auto mode 1 /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java 1071 manual mode 2 /usr/lib/jvm/java-7-oracle/jre/bin/java 1072 manual mode 3 /usr/lib/jvm/java-8-oracle/jre/bin/java 1073 manual mode Press enter to keep the current choice[*], or type selection number: 2 update-alternatives: using /usr/lib/jvm/java-7-oracle/jre/bin/java to provide /usr/bin/java (java) in manual mode $ sudo update-alternatives --config javac There are 3 choices for the alternative javac (providing /usr/bin/javac). Selection Path Priority Status ------------------------------------------------------------ * 0 /usr/lib/jvm/java-8-oracle/bin/javac 1073 auto mode 1 /usr/lib/jvm/java-7-openjdk-amd64/bin/javac 1071 manual mode 2 /usr/lib/jvm/java-7-oracle/bin/javac 1072 manual mode 3 /usr/lib/jvm/java-8-oracle/bin/javac 1073 manual mode Press enter to keep the current choice[*], or type selection number: 2 update-alternatives: using /usr/lib/jvm/java-7-oracle/bin/javac to provide /usr/bin/javac (javac) in manual mode $ java -version java version "1.7.0_80" Java(TM) SE Runtime Environment (build 1.7.0_80-b15) Java HotSpot(TM) 64-Bit Server VM (build 24.80-b11, mixed mode) </code></pre> <h2>Setting the <code>JAVA_HOME</code> environment variable</h2> <p>On Ubuntu Linux, system environment variable can be set in <code>/etc/environment</code> by adding the line</p> <pre><code>JAVA_HOME="/usr/lib/jvm/java-7-oracle" </code></pre> <p>Alternatively, set it in <code>$HOME/.bashrc</code> or <code>$HOME/.bash_profile</code></p> <h2>References</h2> <ul> <li> <p><a href= "https://www.digitalocean.com/community/tutorials/how-to-install-java-on-ubuntu-with-apt-get"> digitalocean.com,〈How To Install Java on Ubuntu with Apt-Get〉</a></p> </li> <li> <p> http://askubuntu.com/questions/56104/how-can-i-install-sun-oracles-proprietary-java-jdk-6-7-8-or-jre</p> </li> <li> <p><a href= "http://www.webupd8.org/2012/01/install-oracle-java-jdk-7-in-ubuntu-via.html"> webup8.org,〈INSTALL ORACLE JAVA 7 IN UBUNTU OR LINUX MINT VIA PPA REPOSITORY〉</a></p> </li> <li> <p><a href= "http://www.webupd8.org/2012/09/install-oracle-java-8-in-ubuntu-via-ppa.html"> webup8.org,〈INSTALL ORACLE JAVA 8 IN UBUNTU OR LINUX MINT VIA PPA REPOSITORY〉</a></p> </li> <li> <p><a href= "http://www.java.com/en/download/faq/java_mac.xml">〈java.com documentation: Information and system requirements for installing and using Mac Java 7〉</a></p> </li> </ul>