Install and configure Sphinx in Ubuntu

Sphinx – search engine with integration of API and MySQL databases, PostgreSQL.

Installation command:

sudo apt-get install sphinxsearch

After installation, tcp ports 9312 and 9306 are used.

Install the MySQL database server:

sudo apt-get install mysql-server mysql-client

Create a test database:

mysql -u root -p
CREATE DATABASE test;
SOURCE /etc/sphinxsearch/example.sql;
quit

Make a copy of the sample configuration file:

sudo cp /etc/sphinxsearch/sphinx.conf.sample /etc/sphinxsearch/sphinx.conf

Fill in the required parameters including data for connecting to the database.
An example of opening a configuration file in the nano editor (Ctrl+X to exit and y/n to save or discard changes):

sudo nano /etc/sphinxsearch/sphinx.conf

Activate sphinxsearch by specifying START=yes in the following file:

sudo nano /etc/default/sphinxsearch

Run sphinxsearch:

sudo service sphinxsearch start

Adding data to the index:

sudo indexer --all

An example of adding to cron:

sudo crontab -e
@hourly /usr/bin/indexer --rotate --config /etc/sphinxsearch/sphinx.conf --all

Command line search example:

search TEXT

Asterisk compile error solution “‘pjsip_tcp_transport_cfg’ has no member named ‘sockopt_params’”

Once I compiled Asterisk version 13.13.1 and when running make I noticed the following error:

‘pjsip_tcp_transport_cfg’ has no member named ‘sockopt_params’

pjproject-2.2.1 has already been compiled.

Solved the problem by compiling a newer version of pjproject-2.4.5

cd /usr/src
wget http://www.pjsip.org/release/2.4.5/pjproject-2.4.5.tar.bz2
tar -xjvf pjproject-2.4.5.tar.bz2
cd pjproject-2.4.5
CFLAGS='-DPJ_HAS_IPV6=1' ./configure --prefix=/usr --enable-shared --disable-sound --disable-resample --disable-video --disable-opencore-amr
make dep
make
make install

After that, the error disappeared.

Hidden files and directories in Ubuntu

Method 1
Put a dot at the beginning of the file or directory name.

Method 2
Create a .hidden file, place in a directory in which you need to hide something and write in it a column of the names of files or folders that should be hidden. The case of letters has a meaning, that is, if the name of an element is from a capital letter, then write it in the .hidden file in the same way.

To see the hidden items through the Nautilus file manager, you must press the key combination Ctrl+H or in the “View” menu click “Show hidden files”.

Ufw setup in Ubuntu

ufw stands for Uncomplicated Firewall.

If ufw is not installed in the system, then install it with the command:

sudo aptitude install ufw

The command activates ufw in the system, it will also be included every time the system starts:

sudo ufw enable

If ufw does not start after restarting the system, then edit ENABLED=no to ENABLED=yes in the file:

sudo nano /etc/ufw/ufw.conf

To disable is used:

sudo ufw disable

Deny all incoming connections:

sudo ufw default deny

To allow access for a subnet or address:

sudo ufw allow from 10.0.0.0/24

To re-enable all incoming connections:

sudo ufw default allow

Permit SSH connection from outside:

sudo ufw allow ssh

An example of allowing access to a specific port:

sudo ufw allow 80/tcp

View status:

sudo ufw status
sudo ufw status verbose

Disable logging:

sudo ufw logging off

View profiles for applications:

sudo ufw app list

The configuration files are in /etc/default/ufw and /etc/ufw/applications.d

View official documentation:

man ufw

See also my article – Configure IPTables

Installing and configuring Tiny Tiny RSS in Ubuntu

Tiny Tiny RSS – aggregator of RSS feeds, which can be viewed in a single personal web-interface.

To get started, download the latest Tiny Tiny RSS version by running the command:

git clone https://github.com/gothfox/Tiny-Tiny-RSS tt-rss

Install the web server and MySQL server if they are not installed:

sudo apt-get install apache2 php5 mysql-server mysql-client

Create a database:

mysql -p -e "CREATE DATABASE `ttrssdb` CHARACTER SET utf8"

The previously downloaded directory from Tiny Tiny RSS will be moved to the web server directory:

sudo mv ~/tt-rss/ /var/www/

Open the installation directory in the browser http://HOSTNAME/tt-rss/install/, and follow the instructions on the screen.

After installation, open the main page http://HOSTNAME/tt-rss/ and enter the name: admin, password: password.

To update the RSS, add the following line to /etc/crontab:

*/30 * * * * /usr/bin/php /var/www/tt-rss/update.php --feeds --quiet

Alternatively, in the configuration file config.php, we change the parameter SIMPLE_UPDATE_MODE from false to true, and the RSS feeds will be updated when the web interface is opened.

In the settings it is desirable to change the administrator password.

Recovering file systems using fsck

Fsck (File System ChecK) – checks and restores file systems.

Before starting the scan, unmount the file system with the command:

umount /dev/sda1

An example of starting a scan (where /dev/sda1 is a device or partition to be checked):

fsck -V -C -f /dev/sda1

View brief documentation:

man fsck

I will describe some startup keys:
-C (display progress bar if possible)
-M (do not check mounted file systems)
-p (auto mode)
-y (agree to all questions)
-n (disagree on all questions)
-f (forced check)
-V (more detailed information)

Installing and using the nbtscan network scanner

Install command in Linux Ubuntu/Debian:

sudo apt-get install nbtscan

The Windows version can be downloaded from http://www.unixwiz.net/tools/nbtscan.html

Network scan example:

nbtscan 192.168.1.0/24

I will describe the possible startup keys:
-O FILENAME (output information to file)
-v (more detailed information output)
-p (port indication)
-H (generate HTTP header)
-m (MAC address indication)
-n (do not convert names to DNS, display only IP)
-t NUMBER (response time in seconds, default 1)
-v (display version nbtscan)

Minicom error solution “Device /dev/ttyS0 is locked”

Sometimes if the connection to Linux from which the connection was made via Minicom is lost, then the next time you start Minicom, you could see an error:

Device /dev/ttyS0 is locked.

The name /dev/ttyS0 may be different, depending on what COM port you have.
To avoid such an error, it is necessary to correctly shut down Minicom using the CTRL-A keys and then the Q key.

You can solve the problem by killing the process as a root user with the command:

killall -9 minicom

In Ubuntu, use the command:

sudo killall -9 minicom

Or you can simply delete the file «LCK..ttyS0» in the /var/lock/ directory.

After that, the error will not be displayed.