Friday, April 21, 2017

How to configure fan in Dell laptop on Debian

For people who run Linux on their dell laptops have a problem that their fan is running noisily all the time. So the fix is to install a tool "i8kutils" which can be used to control fan depending on temperature of CPU.
First make sure that your current user is sudo user and install the tool:

sudo apt-get install i8kutils


Add a line "i8k" in /etc/modules:

sudo vim /etc/modules


Add a line "options i8k force=1" in a new file /etc/modprobe.d/options:

sudo vim /etc/modprobe.d/options


Run:

sudo modprobe i8k force=1


Open a new file called /etc/i8kmon.conf:

sudo vim /etc/i8kmon.conf


Copy the following to it:

# Run as daemon, override with --daemon option
set config(daemon) 0

# Automatic fan control, override with --auto option
set config(auto) 1

# Report status on stdout, override with --verbose option
set config(verbose) 1

# Status check timeout (seconds), override with --timeout option
set config(timeout) 20

# Temperature thresholds: {fan_speeds low_ac high_ac low_batt high_batt}
set config(0) {{-1 0} -1 40 -1 40}
set config(1) {{-1 1} 40 60 40 60}
set config(3) {{-1 2} 60 128 60 128}

# For computer with 2 fans, use a variant of this instead:
# Temperature thresholds: {fan_speeds low_ac high_ac low_batt high_batt}
# set config(0) {{-1 0} -1 52 -1 65}
# set config(1) {{-1 1} 41 66 55 75}
# set config(2) {{-1 1} 55 80 65 85}
# set config(3) {{-1 2} 70 128 75 128}

To run i8kmon daemon on startup, make a new file /etc/init.d/i8kmon:

sudo vim /etc/init.d/i8kmon


Then add the following to it:
(in my case debian-8 jessie, this file was created automatically when the tool was installed)

#!/bin/sh

### BEGIN INIT INFO
# Provides: i8kmon
# Required-Start:
# Required-Stop:
# Should-Start: $local_fs
# Should-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Dell Inspiron fan/cpu-temperature monitor
### END INIT INFO

# i8kmon Dell Inspiron fan/cpu-temperature monitor
#
# Written by Miquel van Smoorenburg .
# Modified for Debian GNU/Linux
# by Ian Murdock .
#
# Modified for i8kutils by Karl E. Jørgensen ,
# Massimo Dal Zotto and
# Bradley Smith

PATH=/sbin:/bin:/usr/sbin:/usr/bin

. /lib/lsb/init-functions

NAME=i8kmon
DAEMON=/usr/bin/i8kmon
PROC_I8K=/proc/i8k
DESC="Dell Inspiron fan/cpu-temperature monitor"
# DAM orig: "--daemon --nouserconfig"
I8KMON_ARGS="--auto --daemon"
PIDFILE=/var/run/$NAME.pid
ENABLED=0

test -x $DAEMON || exit 5

if [ -f /etc/default/$NAME ] ; then
. /etc/default/$NAME
fi

case "$1" in
start)
if [ "$ENABLED" = 0 ]; then
log_warning_msg "Not starting. Disabled via /etc/default/$NAME."
exit 0
fi
log_daemon_msg "Starting $DESC" "$NAME"
modprobe i8k >/dev/null 2>&1 || true
if [ ! -f "$PROC_I8K" ]; then
log_progress_msg "Could not find $PROC_I8K."
log_end_msg 1
exit 1
fi
start-stop-daemon --start --quiet --pidfile $PIDFILE \
--background --make-pidfile --exec $DAEMON -- $I8KMON_ARGS
log_end_msg $?
;;
stop)
log_daemon_msg "Stopping $DESC" "$NAME"
start-stop-daemon --oknodo --stop --quiet --pidfile $PIDFILE
log_end_msg $?
rm -f $PIDFILE
;;
restart|reload|force-reload)
$0 stop && sleep 2 && $0 start
;;
*)
echo "Usage: $0 {start|stop|restart|reload|force-reload}" >&2
exit 2
;;
esac


then restart the machine.

Tuesday, February 7, 2017

Create a simple Angular 2 project

In the previous post, we installed node.js and npm. They are needed in our next step to create Angular 2 project.
First, we have to install angular-cli, which will be used to create an angular project, using npm.
npm install -g angular-cli
After that using the angular-cli, we can create angular2 project.
ng new your-project-name
And go to the project directory and run the server.
cd your-project-name
ng serve
The first project will be run on http://localhost:4200.

How to install node.js on Linux Mint 18 Sarah

curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash -
sudo apt-get install -y nodejs
After that npm is also installed along with node.js. To check version of node write:
node -v
To check npm:
npm
To update npm to the latest version:
sudo npm install npm@latest -g
To fix npm permissions, first, create a folder in current user's home directory. Copy directory path to the newly created folder.
mkdir npm-global
cd npm-global
pwd
Set npm prefix setting to that folder.
npm config set prefix /home/current-user/npm-global
Add path /home/current-user/npm-global/bin to the system PATH settings. Open .profile file.
vi ~/.profile
Add following line to the file
export PATH=$PATH:/home/current-user/npm-global/bin
Reset settings by:
source ~/.profile

Monday, November 28, 2016

How to install missing packages of Latex under linux

  1. Download the missing package from Internet.
  2. Extract it somewhere
  3. Look for a file that has .ins format.
  4. Run a command
    latex file_name.ins
    It will generate files with .sty format.
  5. Create a new folder with appropriate package name e.g., curves. Copy .sty to /usr/share/texlive/texmf-dist/tex/latex/new_folder/
  6. Run
  7. texhash

    for reloading latex cache.

Saturday, August 6, 2016

To install the latest flash player in linux

Run command below.

sudo apt-get install adobe-flashplugin

It was working for Mozilla, but not for Chromium.

Wednesday, July 20, 2016

Installing SciPy Stack

in Ubuntu/Debian:

To install Scipy:
sudo apt-get install python-numpy python-scipy python-matplotlib ipython ipython-notebook python-pandas python-sympy python-nose python-tk

To install Scikit-learn
sudo apt-get install pip
sudo pip install -U scikit-learn

To install NLTK
sudo pip install -U setuptools
sudo pip install -U nltk

To install Pandas
sudo pip install pandas

To install Jupyter notebook
sudo pip install jupyter 

First you have to install setuptools before installing jupyter notebook.

Tuesday, July 19, 2016

After fresh new ubuntu linux installation guide

Ubuntu 16.04 LTS

1. Mouse accelerator was too fast. So I run these commands to make it slower.

to see list of devices:
 xinput --list --short 

to see configuration of my mouse: (my mouse id was 11)
xinput --list-props 11

to set mouse accelerator to 0.5:
xinput --set-prop 11 275 0.5

Here is the full instruction.


2. Installed unity-tweak-tool to add new cool desktop actions such as toggling desktop as mouse approaches the left bottom corner. 

sudo apt-get install unity-tweak-tool

but It was not working, so as advised I installed this:

sudo apt-get install compizconfig-settings-manager compiz-plugins-extra -y

after that type ccs in search bar and run the program. Inside the program go to 'desktop' section, choose
'Ubuntu Unity Plugin', inside go to 'Switcher' tab and uncheck 'Show live previews of windows in the Switcher'.


Afterwards, it worked. But I have no idea the last steps had effected or not.

3. Then I installed terminator with 

sudo apt-get install terminator

4. Install Chrome. Go to https://www.google.com/intl/en-US/chrome/browser
then download appropriate version, and install with command.

cd /~/Downloads

sudo dpkg -i google-chrome-stable-current_amd64.deb

5. Install Keepass, password saver. 


sudo apt-get install keepass2

6. Install Dropbox

Download from https://www.dropbox.com/install?os=lnx

cd /~/Downloads

sudo dpkg -i package-name


7. Install Thunderbird

sudo add-apt-repository ppa:lucid-bleed/ppa
sudo apt-get update
sudo apt-get install thunderbird thunderbird-locale-en-us thunderbird-gnome-support
The latest Thunderbird was installed as default in Ubuntu.

8. Install Apache2 server

sudo apt-get install apache2


9. Install vim

sudo apt-get install vim

10. From Badaa's twitter: I agree that the Ubuntu a spyware is. If you must use it for any reason, sudo apt-get purge unity-webapps-common is a must-do.

It removes unity-tweak-tool, so reinstalled it again.

11. Install Java

First run these commands:


sudo apt-get purge openjdk*
sudo apt-add-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer
 
Create a file /etc/profile.d/oraclejdk.sh with the following content (adapt the paths to reflect the path where you stored your JDK)
 
export J2SDKDIR=/usr/lib/jvm/java-8-oracle
export J2REDIR=/usr/lib/jvm/java-8-oracle/jre
export PATH=$PATH:/usr/lib/jvm/java-8-oracle/bin:/usr/lib/jvm/java-8-oracle/db/bin:/usr/lib/jvm/java-8-oracle/jre/bin
export JAVA_HOME=/usr/lib/jvm/java-8-oracle
export DERBY_HOME=/usr/lib/jvm/java-8-oracle/db

http://askubuntu.com/questions/521145/how-to-install-oracle-java-on-ubuntu-14-04

https://www.digitalocean.com/community/tutorials/how-to-install-java-with-apt-get-on-debian-8

12. Install git

sudo apt-get install git-all






But git was installed as default in Ubuntu.

13. Install apache modules for php7

sudo apt-get install libapache2-mod-php7.0

sudo apt-get install php7.0-mbstring
sudo apt-get install php7.0-xml

After this, you can test phpinfo(); on apache server.

14. Install Laravel
install Composer first:

curl -sS https://getcomposer.org/installer | php

move composer.phar file to /usr/local/bin under name composer.

sudo mv  composer.phar /usr/local/bin/composer

15. Clone laravel project from git repository in /var/www/html. Go to the project directory. Run:

sudo composer update