oBook‎ > ‎

Linux Beginner

In this note, there are some basic information for Ubuntu:

- After installing Ubuntu by Virtual Box you have screen problem probably to solve this issue use: "Guest Addition Installation CD" 
from "Devices" in the menu and install the package to improve your experience.

- When you want to work with a shared folder under Virtual Box you may get some "permission denied" notice. For gaining access you need to do the following:
sudo adduser xxx vboxsf

xxx is your user account name and you need to log out and log in back again to have the error resolved.

- Ubuntu has package installer you won't need much afford to install packages on Ubuntu; it's like what is done in Mac Os. However for using the command line is very easy as the guide on Ubuntu webpage. In short you need to know: 
for installation of software xxx:
sudo apt-get install xxx

And for uninstall remove.

- Good and practical help about "making"  c++ projects can be accessed at: http://mrbook.org/tutorials/make/.
In short for c++ use g++ and c use gcc. 
if you want to use command line you may follow as:
g++ main.cpp hello.cpp factorial.cpp -o hello
We can use make command if there is a make file as:
make MyMakefile
And for executing the resulted file which comes afterwards you need to use "./xxx"; xxx is your file name.
- Commands in Terminal:
    - Open a new terminal: Ctrl+alt+t  
    - List files in the folder: ls
    - Get in to a folder: cd xxx
    - Get back from: cd ..
    - Editor in command: vi xxx.txt  or gedit xxx.txt &
    - See the list of running processes under the terminal: ps
        - for all users: ps -a
        - for all: -A
    - Stop a process by its PID: kill PIDNUMBER
    - Ctrl+Alt+Del: gnome-system-monitor
  - Delete a directory with entire contents by: rm -rf dirxxx/
  - Run install: sudo ./install.sh
  -   
- Eclipse menu doesn't show correctly on Ubuntu 13.1: Run it from terminal by : 
$ #!/bin/bash
$ export UBUNTU_MENUPROXY=0

or
UBUNTU_MENUPROXY = 0 
eclipse
- Install eclipse c++ plugin by: sudo apt-get install eclipse eclipse-cdt g++
- Install modules in kernel mode: sudo insmod xxx.ko List kernel modules: lsmod Remove kernel modules: sudo rmmod xxx
- Show list of the serial ports : 
  setserial -g /dev/ttyS[0123]   dmesg | grep tty

Install Ubuntu

posted Jul 8, 2016, 2:40 AM by Javad Taghia

make a bootable usb
on windows:
download rufus
  1. Open Rufus and select your USB stick in the 'Device' dropdown

  2. Click the CD Rom icon next to the 'FreeDOS' dropdown, then find your downloaded Ubuntu ISO and click 'Open' and then 'Start'

  3. Click 'Yes' when it asks to download Syslinux software

  4. Click 'OK' to write in ISO Image mode

  5. Confirm that your USB stick is selected and then 'OK' to continue

  6. When it is finished, just restart your computer and start using Ubuntu, or you can install Ubuntu

on ubuntu:
  1. nsert a USB stick with at least 2GB of free space

  2. Open the dash and search for Startup Disk Creator

  3. Select the Startup Disk Creator to launch the app

    Find the Startup Disk Creator
  4. Click 'Other' to choose the downloaded ISO file if it isn’t found automatically, select the file and click 'Open'

    Select the ISO
  5. Select the USB stick in the bottom box and click 'Make Startup Disk' and then 'Yes'

    Confirm USB stick
  6. That's it! When the process completes, you'll be ready to restart your computer and begin installing Ubuntu

    Writing the ISO to disk

After installation if it doesn't boot, repair boot as follows:
  1. Insert or connect the Ubuntu live media (DVD or USB).
  2. Find out how to boot your computer from removable media.

    Note that there is a difference between booting of older computers (BIOS/MBR) and newer ones designed for Windows 8 and later releases (UEFI/GPT).

    Reboot the computer from live media and choose Try Ubuntu when asked.

    Try Ubuntu

  3. Connect to the internet, then open a terminal with Ctrl+Alt+t, paste the following commands and run them by pressing Enter:

    sudo add-apt-repository -y ppa:yannubuntu/boot-repair; \
    sudo apt-get update; \
    sudo apt-get install -y boot-repair && boot-repair
    

    Note: You copy and run them all at once. If you want to run them individually just remove the trailing "; \".

    That's it, the Boot-Repair window will appear!

    Boot-Repair main window

Related:

Linux build essential

posted Jun 28, 2016, 5:51 AM by Javad Taghia

  • GCC 4.4.x or later
  • CMake 2.8.7 or higher
  • Git
  • GTK+2.x or higher, including headers (libgtk2.0-dev)
  • pkg-config
  • Python 2.6 or later and Numpy 1.5 or later with developer packages (python-dev, python-numpy)
  • ffmpeg or libav development packages: libavcodec-dev, libavformat-dev, libswscale-dev
  • [optional] libtbb2 libtbb-dev
  • [optional] libdc1394 2.x
  • [optional] libjpeg-dev, libpng-dev, libtiff-dev, libjasper-dev, libdc1394-22-dev

The packages can be installed using a terminal and the following commands or by using Synaptic Manager:

1 [compiler] sudo apt-get install build-essential
2 [required] sudo apt-get install cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev
3 [optional] sudo apt-get install python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev



Installation in Linux

These steps have been tested for Ubuntu 10.04 but should work with other distros as well.

Required Packages

  • GCC 4.4.x or later
  • CMake 2.8.7 or higher
  • Git
  • GTK+2.x or higher, including headers (libgtk2.0-dev)
  • pkg-config
  • Python 2.6 or later and Numpy 1.5 or later with developer packages (python-dev, python-numpy)
  • ffmpeg or libav development packages: libavcodec-dev, libavformat-dev, libswscale-dev
  • [optional] libtbb2 libtbb-dev
  • [optional] libdc1394 2.x
  • [optional] libjpeg-dev, libpng-dev, libtiff-dev, libjasper-dev, libdc1394-22-dev

The packages can be installed using a terminal and the following commands or by using Synaptic Manager:

1 [compiler] sudo apt-get install build-essential
2 [required] sudo apt-get install cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev
3 [optional] sudo apt-get install python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev

Getting OpenCV Source Code

You can use the latest stable OpenCV version or you can grab the latest snapshot from our Git repository.

Getting the Latest Stable OpenCV Version

Getting the Cutting-edge OpenCV from the Git Repository

Launch Git client and clone OpenCV repository. If you need modules from OpenCV contrib repository then clone it too.

For example

1 cd ~/<my_working_directory>
2 git clone https://github.com/Itseez/opencv.git
3 git clone https://github.com/Itseez/opencv_contrib.git

Building OpenCV from Source Using CMake

  1. Create a temporary directory, which we denote as <cmake_build_dir>, where you want to put the generated Makefiles, project files as well the object files and output binaries and enter there.

    For example

    1 cd ~/opencv
    2 mkdir build
    3 cd build
  2. Configuring. Run cmake [<some optional parameters>] <path to the OpenCV source directory>

    For example

    1 cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local ..

    or cmake-gui

    • set full path to OpenCV source code, e.g. /home/user/opencv
    • set full path to <cmake_build_dir>, e.g. /home/user/opencv/build
    • set optional parameters
    • run: “Configure”
    • run: “Generate”
  3. Description of some parameters
    • build type: CMAKE_BUILD_TYPE=Release\Debug
    • to build with modules from opencv_contrib set OPENCV_EXTRA_MODULES_PATH to <path to opencv_contrib/modules/>
    • set BUILD_DOCS for building documents
    • set BUILD_EXAMPLES to build all examples
  4. [optional] Building python. Set the following python parameters:
    • PYTHON2(3)_EXECUTABLE = <path to python>
    • PYTHON_INCLUDE_DIR = /usr/include/python<version>
    • PYTHON_INCLUDE_DIR2 = /usr/include/x86_64-linux-gnu/python<version>
    • PYTHON_LIBRARY = /usr/lib/x86_64-linux-gnu/libpython<version>.so
    • PYTHON2(3)_NUMPY_INCLUDE_DIRS = /usr/lib/python<version>/dist-packages/numpy/core/include/
  5. [optional] Building java.
    • Unset parameter: BUILD_SHARED_LIBS
    • It is useful also to unset BUILD_EXAMPLES, BUILD_TESTS, BUILD_PERF_TESTS - as they all will be statically linked with OpenCV and can take a lot of memory.
  6. Build. From build directory execute make, recomend to do it in several threads

    For example

    1 make -j7 # runs 7 jobs in parallel
  7. [optional] Building documents. Enter <cmake_build_dir/doc/> and run make with target "html_docs"

    For example

    1 cd ~/opencv/build/doc/
    2 make -j7 html_docs
  8. To install libraries, from build directory execute
    1 sudo make install
  9. [optional] Running tests

    For example

    1 git clone https://github.com/Itseez/opencv_extra.git
    • set OPENCV_TEST_DATA_PATH environment variable to <path to opencv_extra/testdata>.
    • execute tests from build directory.

    For example

    1 <cmake_build_dir>/bin/opencv_test_core
Note
If the size of the created library is a critical issue (like in case of an Android build) you can use the install/strip command to get the smallest size as possible. The stripped version appears to be twice as small. However, we do not recommend using this unless those extra megabytes do really matter.

Generated on Fri Dec 18 2015 16:45:22 for OpenCV by   doxygen 1.8.9.1

Linux Emulator

posted Mar 7, 2016, 7:37 PM by Javad Taghia

Very practical emulator for Linux:
http://bellard.org/jslinux/

MySQL

posted May 17, 2014, 1:12 PM by Javad Taghia   [ updated May 17, 2014, 1:12 PM ]

- Intro: http://www.yolinux.com/TUTORIALS/LinuxTutorialMySQL.html

Useful Packages/Apps

posted May 17, 2014, 12:33 PM by Javad Taghia   [ updated May 17, 2014, 12:40 PM ]

- Htop: it's a good software as a process viewer; it can be used as processes window in Windows.
- g++
- eclipse
- eclipse cdt plug-in: sudo apt-get install eclipse eclipse-cdt g++
- Mysql: apt-get install mysql-client --- apt-get install mysql-server

1-5 of 5