To get apache2 working with php7 (or even lower perhaps?) on Linux you might need to download also the mod for php7
sudo apt-get install libapache2-mod-php7.0
Warning: the below might make your CPU run hotter or overheat – use at your own risk!
A new Ubuntu 16.04.1 installation – after short usage the computer slows down and the CPUs are about 50% busy. There are some kidle_inject processes running which take this valuable CPU.
Top shows the following:
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 6898 root -51 0 0 0 0 S 47.1 0.0 1:20.16 kidle_inject/5 6900 root -51 0 0 0 0 S 47.1 0.0 1:20.38 kidle_inject/7 6894 root -51 0 0 0 0 S 41.2 0.0 1:13.55 kidle_inject/1 6895 root -51 0 0 0 0 S 41.2 0.0 1:16.90 kidle_inject/2 6896 root -51 0 0 0 0 S 41.2 0.0 1:18.28 kidle_inject/3 6897 root -51 0 0 0 0 S 41.2 0.0 1:18.64 kidle_inject/4 6899 root -51 0 0 0 0 S 41.2 0.0 1:20.02 kidle_inject/6 6893 root -51 0 0 0 0 S 29.4 0.0 1:08.23 kidle_inject/0
To stop these processes run the following command – it will disable them only for the current session. I very rarely reboot so I haven’t looked into making it permanent yet.
$ sudo rmmod intel_powerclamp
It is nice to have an IRC connection that is always available and that doesn’t have your home IP address exposed. With the ZNC setup you can then use your local IRC client (BitchX, irssi, HexChat etc) to connect to the ZNC and you will be able to see all the networks and channels it is connected to. This tutorial will explain how to setup ZNC on a $5/month DigitalOcean droplet (ref link) with Ubuntu 16.04.1. Of course this setup should work on any hosting and setup – DigitalOcean is just given as an example here.
Create a Droplet
1. Press on the Create a Droplet button once you are logged in your DO account
- Select the OS image (Ubuntu 16.04.X), the Droplet size/price ($5/mo), data center region, add extra features, ssh key if you want that extra security and then press on Create Droplet
2. Login to your Droplet (box) and make sure everything is up to date
sudo apt-get update sudo apt-get upgrade
Installation and Build of ZNC
1. Grab few essentials that are needed to compile the ZNC from source
sudo apt-get install build-essential libssl-dev libperl-dev pkg-config
2. Grab the latest ZNC source tar ball
cd /usr/local/src; sudo wget http://znc.in/releases/znc-latest.tar.gz
3. Extract the package and enter the directory
sudo tar -xzvf znc-latest.tar.gz; cd znc*
4. Configure the source system wide (you can use ./configure –prefix=$HOME/znc if you don’t want system wide)
5. Then, compile ZNC (might take few minutes)
sudo make; sudo make install
Configuration of ZNC
1. Create a new user on which we will run ZNC
2. Switch to the new user
su znc-admin; cd ~
3. Start ZNC and its configuration
4. Below is a sample configuration (ZNC version 1.6.4) – I highlighted in red all the config that I entered manually, the rest is the default values (what is given in the brackets [ ])
[ .. ] Checking for list of available modules... [ >> ] ok [ ** ] [ ** ] -- Global settings -- [ ** ] [ ?? ] Listen on port (1025 to 65534): 14125 [ ?? ] Listen using SSL (yes/no) [no]: yes [ ?? ] Listen using both IPv4 and IPv6 (yes/no) [yes]: yes [ .. ] Verifying the listener... [ >> ] ok [ ** ] Unable to locate pem file: [/home/znc-admin/.znc/znc.pem], creating it [ .. ] Writing Pem file [/home/znc-admin/.znc/znc.pem]... [ >> ] ok [ ** ] Enabled global modules [webadmin] [ ** ] [ ** ] -- Admin user settings -- [ ** ] [ ?? ] Username (alphanumeric): redoEm [ ?? ] Enter password: [ ?? ] Confirm password: [ ?? ] Nick [redoEm]: [ ?? ] Alternate nick [redoEm_]: [ ?? ] Ident [redoEm]: [ ?? ] Real name [Got ZNC?]: Redo'Em [ ?? ] Bind host (optional): [ ** ] Enabled user modules [chansaver, controlpanel] [ ** ] [ ?? ] Set up a network? (yes/no) [yes]: [ ** ] [ ** ] -- Network settings -- [ ** ] [ ?? ] Name [freenode]: [ ?? ] Server host [chat.freenode.net]: [ ?? ] Server uses SSL? (yes/no) [yes]: [ ?? ] Server port (1 to 65535) : [ ?? ] Server password (probably empty): [ ?? ] Initial channels: #redoEm [ ** ] Enabled network modules [simple_away] [ ** ] [ .. ] Writing config [/home/znc-admin/.znc/configs/znc.conf]... [ >> ] ok [ ** ] [ ** ] To connect to this ZNC you need to connect to it as your IRC server [ ** ] using the port that you supplied. You have to supply your login info [ ** ] as the IRC server password like this: user/network:pass. [ ** ] [ ** ] Try something like this in your IRC client... [ ** ] /server <znc_server_ip> +14125 redoEm:<pass> [ ** ] [ ** ] To manage settings, users and networks, point your web browser to [ ** ] https://<znc_server_ip>:14125/ [ ** ] [ ?? ] Launch ZNC now? (yes/no) [yes]: [ .. ] Opening config [/home/znc-admin/.znc/configs/znc.conf]... [ >> ] ok [ .. ] Loading global module [webadmin]... [ >> ] [/usr/local/lib/znc/webadmin.so] [ .. ] Binding to port [+34125]... [ >> ] ok [ ** ] Loading user [redoEm] [ ** ] Loading network [freenode] [ .. ] Loading network module [simple_away]... [ >> ] [/usr/local/lib/znc/simple_away.so] [ .. ] Adding server [chat.freenode.net +6697 ]... [ >> ] ok [ .. ] Loading user module [chansaver]... [ >> ] ok [ .. ] Loading user module [controlpanel]... [ >> ] ok [ .. ] Forking into the background... [ >> ] [pid: 19576] [ ** ] ZNC 1.6.4 - http://znc.in
That is it – ZNC is now up and running!
Connect to ZNC with your local IRC Client
Now find the IP address from your Droplet and setup your IRC client to connect to it.
Example with HexChat:
After connecting to the ZNC all the networks and channels you have added will appear.
This might work on other systems too, I tried it on Ubuntu 14.04.1.
In VirtualBox the screen for Ubuntu was very small and it was difficult to see what’s on the screen. To fix this issue, you need to install the following packages on the guest (VM) box:
sudo apt-get install virtualbox-guest-dkms virtualbox-guest-x11
If you get this error:
The following packages have unmet dependencies. virtualbox-guest-x11 : Depends: xorg-video-abi-15
You will need to remove this package (note: I am not sure what all this removes, it was a lot – use caution):
sudo apt-get remove libcheese-gtk23
Then install these
sudo apt-get install xserver-xorg-core-lts-trusty
sudo apt-get install xserver-xorg-core
Then try to install the virtualbox packages, as the first step:
sudo apt-get install virtualbox-guest-dkms virtualbox-guest-x11
Once they install properly, restart the VM and the screen should be normal size. You might need to increase the Display memory in VB before starting the VM.
It happens that sometimes (after 2 days 🙂 ) you forget the password for your root user on MySQL, well there are few steps to perform to recover it.
This was performed on version:
$ mysql -V mysql Ver 14.14 Distrib 5.1.61, for debian-linux-gnu (x86_64) using readline 6.2
The following steps need to be performed as root user, so either login with it or use sudo.
Step 1:Stop the MySQL service
$ sudo /etc/init.d/mysql stop
Step 2: Start the MySQL server without password
$ sudo mysqld_safe --skip-grant-tables &
Step 3: Connect to the MySQL server using the MySQL client
$ sudo mysql -u root
Step 4: Change the password for the root user
mysql> use mysql; Database changed mysql> update user set password=PASSWORD("YOUR_NEW_PASS") where user = 'root'; Query OK, 3 rows affected (0.01 sec) Rows matched: 3 Changed: 3 Warnings: 0 mysql> flush privileges; Query OK, 0 rows affected (0.00 sec) mysql> quit Bye
Step 5: Stop the MySQL server again
$ sudo /etc/init.d/mysql stop
Step 6: Start the MySQL server (normally) and test the new password
$ sudo /etc/init.d/mysql start $ sudo mysql -u root -p
This should also work on Windows as well, you will just need to use different commands for start/stop of the MySQL deamon.
There is a time when you are leaving your home empty and you don’t have an expensive security and alarm system. You need to be protected and be aware if there are any changes or visits that you do not approve of while you are gone. There is an easy way to achieve just that with Motion. What you need is:
- Linux OS (ex. Ubuntu)
- Motion (free)
- Internet (optional)
- Hosting (optional)
- Smartphone with data plan (optional)
After you have your computer ready, webcam installed and working, go and download the Motion project or use Ubuntu’s apt to get it (check to get the latest version):
sudo apt-get install motion
Run the program (Motion) with root privileges, like sudo motion, however please note that you should probably run it with sleep or cron, otherwise it will activate immediately and most probably detect you while you are exiting the room.
Now you are all set for the basic surveillance with just a webcam which will record when there is a movement in front of the camera, however there are some more advanced options which could help a lot.
Email you when there is movement detected
For this you will need to install sendmail and mutt, assuming you are on Ubuntu
sudo apt-get install sendmail mutt
The basic settings for sendmail are enough for most users, but if you are an advanced user feel free to modify it as you desire.
Open the file /etc/motion/motion.conf in your favorite text editor (ex. vim), then locate the text on_even_start value and change the value part with:
echo "This is the body of the message" | mutt -s "Motion has been detected" firstname.lastname@example.org
If there is a ; (semi-colon) on the beginning of the row, remove it, also if there is any empty space before the on_event_start.
Sending images to a webserver
It would be good to have the images taken from the motion to a webserver so that you can check from a remote location what is there on the images and report to the police if needed.
Open the /etc/motion/motion.conf file again in a text editor and locate the text on_picture_save value and change the value part with:
scp %f email@example.com:/path/for/images/
If there is a ; (semi-colon) on the beginning of the row, remove it, also if there is any empty space before the on_picture_save.
Enable login without password on your webserver
You need to create a ssh key on your machine with the following
sudo ssh-keygen -t dsa
Upload the key to your webserver:
sudo ssh-copy-id -i /root/.ssh/id_dsa.pub firstname.lastname@example.org
Tips and tricks: if you have a LED light on your camera, put a plastic electrician tape (isolation tape) on it so that the camera is not noticeable. Also, make sure you have some light in the room, unless the camera has a feature for night vision.
If you need to execute a process that will run in the background so that it does not lock one terminal window then you should try using the NOHUP command.
nohup <command here> &
After executing it, a nohup.out file will be created (append if it exists) which will contain all the output from the command (if any).
However, if you want to close the terminal window, like if you are working on a remote machine, do the following:
(nohup <command here> & ) &
This will disconnect the process from your session completely so you should be able to close the terminal window and do not interrupt the process.
To check if the process is still running, perform the following:
ps -ef|grep -i <command name or part of command name>
This is listing all the processes on the machine and then grepping for the command name with case insensitive (-i).
If you want to stop the process, you will need to kill it with the following command:
kill <process id>
The process-id can be seen from running the ps command above. In most instances it is the first number of the row.
If the process hangs after the kill command, do force kill:
kill -9 <process id>
This will kill any process, so please double check the process id before executing it.
On Asus K53 most of the hot-keys are not working with the default installation of Ubuntu 11.04 with kernel 2.6.38-8, however there is a package available that will enable them, here are instructions on how to perform that:
sudo apt-get install git (unless you already have git installed)
git clone git://git.iksaif.net/acpi4asus-dkms.git
sudo make install
sudo modprobe asus-nb-wmi (this command will load the newly installed module)
After every kernel update the above will be erased and you will need to re-do it every time until it is included in a kernel version at a later stage. To make it easier create a .deb package which will be easier to install.
sudo apt-get install debhelper
sudo dpkg -i [newly-created-package].deb
sudo modprobe asus-nb-wmi
After you install a new applet in some versions of Ubuntu (gnome) it will not be available in the list until you log-out and login again or if you do not restart your computer. This is bad because you will need to close everything to perform either of these things, however it is safe to kill the gnome-panel process and it will then automatically re-load and all the new applets will be available in the list.
No root/sudo privileges are needed for this command.
I have laptop Asus K53SV and the touchpad was recognized as a mouse only. All of the features that it offered were just navigating the pointer, no scrolling, no disable when typing etc.
There is a patch available (elantech) which solves this issue and the touchpad is recognized with all (at least some 🙂 ) features.
First, install the dkms (Dynamic Kernel Module Support) package if it is not already installed on your machine:
sudo apt-get install dkms
Then, download the patch:
sudo wget http://planet76.com/drivers/elantech/psmouse-elantech-v6.tar.bz2
Unpack the patch:
sudo tar jxvf psmouse-elantech-v6.tar.bz2
Add the patch to the psmouse module:
sudo dkms add -m psmouse -v elantech-v6
sudo dkms build -m psmouse -v elantech-v6
sudo dkms install -m psmouse -v elantech-v6
For successful installation you should get something like this at the end: DKMS: install Completed.
Now, to load the new module with the patch included, you will need to either reboot your machine or reload the new module by executing the following command:
sudo rmmod psmouse && sudo modprobe psmouse
Now, go to System -> Preferences -> Mouse -> Touchpad and you will see all the settings that are available for the touchpad! 🙂