Get your server issues fixed by our experts for a price starting at just 25 USD/Hour. Click here to register and open a ticket with us now!

Recent Posts

Pages: 1 [2] 3 4 ... 10
11
General Linux / Some Ways To Get Memcached Stats
« Last post by Vineesh K P on November 23, 2018, 03:23:13 pm »
In this article, we will check out some ways to get stats of Memcached.

For this to work, you need to have an ssh access to the server.

Method 1


  • SSH to the server which has Memcached.
  • Connect to Memcached port as shown below.
    telnet 127.0.0.1 11211
  • Once the connection has been established, type stats and hit enter.

An alternate way to do this is by using the nc command.
echo stats | nc 127.0.0.1 11211

You will get results similar to this.
Code: [Select]
STAT pid 22020
STAT uptime 3689364
STAT time 1227753109
STAT version 1.2.5
STAT pointer_size 64
STAT rusage_user 4543.071348
STAT rusage_system 8568.293421
STAT curr_items 139897
STAT total_items 51710845
STAT bytes 360147055
STAT curr_connections 40
STAT total_connections 66762
STAT connection_structures 327
STAT cmd_get 319992973
STAT cmd_set 51710845
STAT get_hits 280700485
STAT get_misses 39292488
STAT evictions 849165
STAT bytes_read 141320046298
STAT bytes_written 544357801590
STAT limit_maxbytes 402653184
STAT threads 4
END

Method 2

Here’s an easy “top” emulator for Memcached:

watch "echo stats | nc 127.0.0.1 11211"

If you don’t have netcat (nc), you can also use Bash’s built-in /proc/tcp magic if it’s enabled. Anything that can push a couple of characters to a TCP port and print the result to stdout will work. Or you can use something like this, if you must do it via PHP:

watch 'php -r '"'"'$m=new Memcache;$m->connect("127.0.0.1", 11211);print_r($m->getstats());'"'"

Hope you found some value in it.

Until next time, cheers!
12
cPanel / cpanelsolr process and how to disable it on cPanel servers
« Last post by vaishakp on November 22, 2018, 06:50:18 pm »
cpanelsolr was introduced in cPanel version 64. cpanelsolr uses Java to index email messages managed by dovecot. cPanel describe the service as;

------------------------------------------------------------
Fast Email Searching (IMAP Full-Text Search)
Full-Text Search Indexing (powered by Solr) provides fast search capabilities for IMAP mailboxes. Users of iOS devices, Microsoft® Outlook™, SquirrelMail, Horde, Roundcube, and Mozilla™ Thunderbird will notice significantly improved search speed and convenience.
------------------------------------------------------------

How to disable cpanelsolr

1) Login to WHM with the root user account
2) Select “Service Manager”
3) Once the page loads untick the two boxes next to the cpanel-dovecot-solr service.
4) Click save at the bottom of the page

This will now disable the cpanel-dovecot-solr service and you should notice your memory usage won’t be as high. It’s important to remember you should only disable this service if you are having problems with it or your system is running a low amount of memory. Any system over 4GB of ram running the defaults provided by cPanel should be fine leaving the service enabled.
13
Plesk / Plesk website is loading apache default page (Nginx + Apache setup)
« Last post by Shibu B on November 22, 2018, 10:05:37 am »
This error is noticed in domains hosted in plesk servers. Nginx is running in frontend and Apache in the backend. This is mainly due to Apache doesn't reach the configurations added by Plesk.


* As a first step, we need to disable Nginx by using the following command

# /usr/local/psa/admin/bin/nginxmng -d

* Now the frontend web server is switched to apache. Check whether the issue still persists on the websites. If the issue is fixed. Enable Nginx again using the following command. This will resolve the issue.

# /usr/local/psa/admin/bin/nginxmng -e

* Make sure that zz010_psa_httpd.conf file is present in /etc/httpd/conf.d folder and also "IncludeOptional conf.d/*.conf" is addeded in apache conf (/etc/httpd/conf/httpd.conf)


* If the error for website is still not resolved after disabling Nginx, try rebuilding the Apache configuration files for the domain:

# /usr/local/psa/admin/bin/httpdmng --reconfigure-domain <domain_name>

or

# plesk repair web <domain_name>

* If the error is for all domains, please run following command

# /usr/local/psa/admin/bin/httpdmng --reconfigure-all

14
If you receive the following error when connecting remote server via SSH.


Unable to negotiate with xxx.xxx.xxx port 22: no matching host key type found.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists.

In this case, the client and server were unable to agree on the key exchange algorithm. As a workaround, you need to tell your ssh client that you want to accept DSA host keys,

Resolution:

Add following lines into your ~/.ssh/config

Host your-remote-host
    HostkeyAlgorithms +ssh-dss


OR

specify the following option below while connecting via SSH.

ssh -oHostKeyAlgorithms=+ssh-dss user@remotehost.com

15
ERROR!  daq_static library not found, go get it from  http://www.snort.org/

1) check the following command

# which daq-modules-congif

Output be like this.

/usr/bin/which: no daq-modules-congif in (/usr/local/sbin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin)

Then access the daq directory in our case.

cd /usr/local/src/daq-2.0.6/

2) use the following command

export PATH=$PATH:/usr/local/bin

3) run the command

which daq-modules-config

Output will be like this

/usr/local/bin/daq-modules-config


Issue solved  :)

16
Plesk / How to log in to MySQL using the Plesk MySQL "admin"
« Last post by arunlalpr on November 20, 2018, 02:43:45 am »
How to log in to MySQL using the Plesk MySQL "admin"

Kindly use the following command to access Mysql.

MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysql -uadmin psa

17
General Discussion / How To Share Command Output Effectively
« Last post by Vineesh K P on November 19, 2018, 03:55:09 pm »
Hello All,

Today I want to share with you an awesome way to share the Linux command line output to anyone using nc command.

There are several occasions where we wish to share some command line output to someone. Usually, we share this by pasting the output in the message itself. It makes the conversation longer. There is a cooler way to do this, using the "nc" command.

For example, consider you wish to share the output of the following command.

echo hello

You can do this as follows.

$ echo hello | nc seashells.io 1337

You will get an output like this: serving at https://seashells.io/v/HrTNrp4h

When you go to the link mentioned above, you can see the output of the command you have entered earlier.

We recommend you don't pass any sensitive information through this.

Hope you found this useful,

Cheers!
18
Virtualization / How to Install WordPress and PhpMyAdmin using Docker Compose (CentOS 7)
« Last post by akhilu on November 18, 2018, 04:55:30 pm »
Docker is a lightweight container system that lets you run an application in a container, which is like virtual machine. You can refer the below steps to install docker on CentOS 7 and then set up a WordPress instance using a docker file.

Access your server via CLI and run below command to update package database

Code: [Select]
yum check-update
Run the below command to add official Docker repository, download and install the latest version of Docker:

Code: [Select]
curl -fsSL https://get.docker.com/ | sh

Once the installation is over run the below command to start the Docker service

Code: [Select]
systemctl start docker
Verify that the service is active

Code: [Select]
systemctl status docker
Output:

Code: [Select]
● docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
   Active: active (running) since Sun 2018-11-18 08:29:49 UTC; 10s ago
     Docs: https://docs.docker.com
 Main PID: 4352 (dockerd)
    Tasks: 18
   Memory: 55.7M
   CGroup: /system.slice/docker.service
           ├─4352 /usr/bin/dockerd -H unix://
           └─4363 containerd --config /var/run/docker/containerd/containerd.toml --log-level info
           
           

Please Note: Most of the cloud service like DigitalOcean and AWS etc offers OS  images that comes with Docker preinstalled. Hence you are using cloud hosting service like AWS, DiditalOcean then you can use the Docker image while deploying the server so that you do not have to do the above steps manually.

Once the Docker is installed you can use the below command to check the Docker version

Code: [Select]
docker version
Output:

Code: [Select]
Client:
 Version:           18.09.0
 API version:     1.39
 Go version:      go1.10.4
 Git commit:      4d60db4
 Built:                Wed Nov  7 00:48:22 2018
 OS/Arch:          linux/amd64
 Experimental:   false

Server: Docker Engine - Community
 Engine:
  Version:            18.09.0
  API version:      1.39 (minimum version 1.12)
  Go version:       go1.10.4
  Git commit:       4d60db4
  Built:                 Wed Nov  7 00:19:08 2018
  OS/Arch:          linux/amd64
  Experimental:   false


Now that Docker is installed we need to install Docker-Compose. Please install python-pip as prerequisite using below commands:

Code: [Select]
yum install epel-release
yum install -y python-pip

Then you can install Docker Compose:

Code: [Select]
pip install docker-compose
Once docker compose is installed we need to create a new folder for WordPress installation and move into the folder. Please use the below command:

Code: [Select]
mkdir ~/wordpress && cd $_
Now use the below command to create a docker compose yml file for WordPress installation

Code: [Select]
vim docker-compose.yml

Then pase the below content into the yml file and save it.

Code: [Select]
version: '2'
services:
  wordpress:
    depends_on:
      - db
    image: wordpress:4.7.1
    restart: always
    volumes:
      - ./wp-content:/var/www/html/wp-content
    environment:
      WORDPRESS_DB_HOST: db:3306
      WORDPRESS_DB_PASSWORD: p4ssw0rd!
    ports:
      - 80:80 # Expose http and https
      - 443:443
    networks:
      - back
  db:
    image: mysql:5.7
    restart: always
    volumes:
       - ./db_data:/var/lib/mysql
    environment:
      MYSQL_ROOT_PASSWORD: p4ssw0rd!
    networks:
      - back
  phpmyadmin:
    depends_on:
      - db
    image: phpmyadmin/phpmyadmin
    restart: always
    ports:
      - 8080:80
    environment:
      PMA_HOST: db
      MYSQL_ROOT_PASSWORD: p4ssw0rd!
    networks:
      - back
networks:
  back:
volumes:
  db_data:

Please Note The above code will download docker images of WordPress 4.7.1, MySQL 5.7 and PhpMyAdmin images from docker repository and run it.

Please Note It will also create folder ./db_data and ./wp-content  in the wordpress directory that we created earlier and sync the wp-content folder and the database contact into it. This will help us save website data on the server so that even if we remove the containers later the website data will be still safe on the server.

You can use the below command to execute the Docker compose file

Code: [Select]
docker-compose up -d
Output:

Code: [Select]
Pulling db (mysql:5.7)...
5.7: Pulling from library/mysql
a5a6f2f73cd8: Pull complete
936836019e67: Pull complete
283fa4c95fb4: Pull complete
1f212fb371f9: Pull complete
e2ae0d063e89: Pull complete
5ed0ae805b65: Pull complete
0283dc49ef4e: Pull complete
a7905d9fbbea: Pull complete
cd2a65837235: Pull complete
5f906b8da5fe: Pull complete
e81e51815567: Pull complete
Pulling wordpress (wordpress:4.7.1)...
4.7.1: Pulling from library/wordpress
5040bd298390: Pull complete
568dce68541a: Pull complete
6a832068e64c: Pull complete
3b0f3d176a5b: Pull complete
20cc248a5690: Pull complete
6ff565538ee6: Pull complete
9f1077228581: Pull complete
57359f144a19: Pull complete
9754ef36b033: Pull complete
e156df35b624: Pull complete
df09daa2224a: Pull complete
bfa0d8031302: Pull complete
fe629d500af7: Pull complete
2761420c8e70: Pull complete
71580740e433: Pull complete
22ff3670a5e6: Pull complete
39f4427993e5: Pull complete
9ab2843f4934: Pull complete
Pulling phpmyadmin (phpmyadmin/phpmyadmin:)...
latest: Pulling from phpmyadmin/phpmyadmin
911c6d0c7995: Pull complete
2527cc05836d: Pull complete
3299172a2d6d: Pull complete
05782106624f: Pull complete
3e3261543ec8: Pull complete
ce1c845d4246: Pull complete
e005e70f55dc: Pull complete
84403a106e16: Pull complete
e4fc13f7949f: Pull complete
2a53e72ea7b9: Pull complete
d791f6b71f27: Pull complete
576bdfd7cc75: Pull complete
20768032f0fb: Pull complete
fc8aa3d46064: Pull complete
bade7addd704: Pull complete
4b30a4dd0b24: Pull complete
b02d6e91d2b5: Pull complete
Creating wordpress_db_1_56e97f6fca35 ... done
Creating wordpress_phpmyadmin_1_45b68f706ee4 ... done
Creating wordpress_wordpress_1_f11d769b43d1  ... done

You can run the below command to see the list of containers that are running on the server:

Code: [Select]
docker ps
Output:
Code: [Select]
CONTAINER ID        IMAGE                   COMMAND                  CREATED             STATUS              PORTS                                      NAMES
e0fcb5383ea3        phpmyadmin/phpmyadmin   "/run.sh supervisord…"   23 minutes ago      Up 23 minutes       9000/tcp, 0.0.0.0:8080->80/tcp             wordpress_phpmyadmin_1_5cb4745b8656
d97b84e9174f        wordpress:4.7.1         "docker-entrypoint.s…"   23 minutes ago      Up 23 minutes       0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp   wordpress_wordpress_1_ae4ee5d1d3b1
f87672746548        mysql:5.7               "docker-entrypoint.s…"   23 minutes ago      Up 23 minutes       3306/tcp, 33060/tcp                        wordpress_db_1_67afaa299feb

Run the below command to see the list of images downloaded by the docker compose the file.

Code: [Select]
docker images -a
Output:
Code: [Select]
REPOSITORY              TAG                 IMAGE ID            CREATED             SIZE
mysql                   5.7                 ae6b78bedf88        2 days ago          372MB
phpmyadmin/phpmyadmin   latest              126b8717cebb        2 months ago        166MB
wordpress               4.7.1               dfbefe759772        22 months ago       400MB

You can then access the server IP to start the WordPress installation. Please refer the below image:

19
General Discussion / Advantages and Disadvantages of Hardware Firewall
« Last post by Vineesh K P on November 18, 2018, 03:29:14 pm »
In this post, we will check the advantages and disadvantages or Hardware Firewalls.

Advantages

  • Speed: Normally, the hardware firewalls are tailored for faster response times, and hence handle more traffic loads.
  • Security: A firewall with its own operating system (proprietary) is less prone for attacks. This, in turn, reduces the security risk. In addition, hardware firewalls have enhanced security controls.
  • No Interference: A box, that is separated from other network components can be managed better, and does not load or slow down other applications. The box can be moved, shutdown, or reconfigured with minimal interference to the network.[/size]

Disadvantages

  • Cost. Normally, a dedicated hardware firewall costs more than a software firewall.
  • Difficult to install, and upgrade.
  • Takes up physical space, and involves wiring.

20
General Discussion / Git Cheat Sheet
« Last post by aravindm on November 18, 2018, 06:39:55 am »
Git is a version-control system for tracking changes in computer files and coordinating work on those files among multiple people. It is primarily used for source-code management in software development, but it can be used to keep track of changes in any set of files.

Set Up and Initialization

Check your Git version with the following command, which will also confirm that Git is installed.
Code: [Select]
git --version
You can initialize your current working directory as a Git repository with init.
Code: [Select]
git init
To copy an existing Git repository hosted remotely, you’ll use git clone with the repo’s URL or server location (in the latter case you will use ssh).

Code: [Select]
git clone https://www.github.com/username/repo-name
Show your current Git directory’s remote repository.
Code: [Select]
git remote
For a more verbose output, use the -v flag.
Code: [Select]
git remote -v
Add the Git upstream, which can be a URL or can be hosted on a server (in the latter case, connect with ssh).
Code: [Select]
git remote add upstream https://www.github.com/username/repo-name

Staging

When you’ve modified a file and have marked it to go in your next commit, it is considered to be a staged file.

Check the status of your Git repository, including files added that are not staged, and files that are staged.
Code: [Select]
git status
To stage modified files, use the add command, which you can run multiple times before a commit. If you make subsequent changes that you want included in the next commit, you must run add again.

You can specify the specific file with add.
Code: [Select]
git add my_script.py
With . you can add all files in the current directory including files that begin with a ..
Code: [Select]
git add .
You can remove a file from staging while retaining changes within your working directory with reset.
Code: [Select]
git reset my_script.py

Committing

Once you have staged your updates, you are ready to commit them, which will record changes you have made to the repository.

To commit staged files, you’ll run the commit command with your meaningful commit message so that you can track commits.
Code: [Select]
git commit -m "Commit message"
You can condense staging all tracked files with committing them in one step.
Code: [Select]
git commit -am "Commit message"
If you need to modify your commit message, you can do so with the --amend flag.
Code: [Select]
git commit --amend -m "New commit message"

Branches

A branch in Git is a movable pointer to one of the commits in the repository, it allows you to isolate work and manage feature development and integrations.

List all current branches with the branch command. An asterisk (*) will appear next to your currently active branch.
Code: [Select]
git branch
Create a new branch. You will remain on your currently active branch until you switch to the new one.
Code: [Select]
git branch new-branch
Switch to any existing branch and check it out into your current working directory.
Code: [Select]
git checkout another-branch
You can consolidate the creation and checkout of a new branch by using the -b flag.
Code: [Select]
git checkout -b new-branch
Rename your branch name.
Code: [Select]
git branch -m current-branch-name new-branch-name
Merge the specified branch’s history into the one you’re currently working in.
Code: [Select]
git merge branch-name
Abort the merge, in case there are conflicts.
Code: [Select]
git merge --abort
You can also select a particular commit to merge with cherry-pick with the string that references the specific commit.
Code: [Select]
git cherry-pick f7649d0
When you have merged a branch and no longer need the branch, you can delete it.
Code: [Select]
git branch -d branch-name
If you have not merged a branch to master, but are sure you want to delete it, you can force delete a branch.
Code: [Select]
git branch -D branch-name

Collaborate and Update

To download changes from another repository, such as the remote upstream, you’ll use fetch.
Code: [Select]
git fetch upstream
Merge the fetched commits.
Code: [Select]
git merge upstream/master
Push or transmit your local branch commits to the remote repository branch.
Code: [Select]
git push origin master
Fetch and merge any commits from the tracking remote branch.
Code: [Select]
git pull

Inspecting

Display the commDisplay the commit history for the currently active branch.
Code: [Select]
git log
Show the commits that changed a particular file. This follows the file regardless of file renaming.
Code: [Select]
git log --follow my_script.py
Show the commits that are on one branch and not on the other. This will show commits on a-branch that are not on b-branch.
Code: [Select]
git log a-branch..b-branch
Look at reference logs (reflog) to see when the tips of branches and other references were last updated within the repository.
Code: [Select]
git reflog
Show any object in Git via its commit string or hash in a more human-readable format.
Code: [Select]
git show de754f5

Show Changes

The git diff command shows changes between commits, branches, and more.

Compare modified files that are on the staging area.
Code: [Select]
git diff --staged
Display the diff of what is in a-branch but is not in b-branch.
Code: [Select]
git diff a-branch..b-branch
Show the diff between two specific commits.
Code: [Select]
git diff 61ce3e6..e221d9c

Stashing

Sometimes you’ll find that you made changes to some code, but before you finish you have to begin working on something else. You’re not quite ready to commit the changes you have made so far, but you don’t want to lose your work. The git stash command will allow you to save your local modifications and revert back to the working directory that is in line with the most recent HEAD commit.

Stash your current work.
Code: [Select]
git stash
See what you currently have stashed.
Code: [Select]
git stash list
Your stashes will be named stash@{0}, stash@{1}, and so on.

Show information about a particular stash.
Code: [Select]
git stash show stash@{0}
To bring the files in a current stash out of the stash while still retaining the stash, use apply.
Code: [Select]
git stash apply stash@{0}
If you want to bring files out of a stash, and no longer need the stash, use pop.
Code: [Select]
git stash pop stash@{0}
If you no longer need the files saved in a particular stash, you can drop the stash.
Code: [Select]
git stash drop stash@{0}
If you have multiple stashes saved and no longer need to use any of them, you can use clear to remove them.
Code: [Select]
git stash clear

Ignoring Files

If you want to keep files in your local Git directory, but do not want to commit them to the project, you can add these files to your .gitignore file so that they do not cause conflicts.

Use a text editor such as nano to add files to the .gitignore file.
Code: [Select]
nano .gitignore

Rebasing

A rebase allows us to move branches around by changing the commit that they are based on. With rebasing, you can squash or reword commits.

You can start a rebase by either calling the number of commits you have made that you want to rebase (5 in the case below).
Code: [Select]
git rebase -i HEAD~5
Alternatively, you can rebase based on a particular commit string or hash.
Code: [Select]
git rebase -i 074a4e5
Once you have squashed or reworded commits, you can complete the rebase of your branch on top of the latest version of the project’s upstream code.
Code: [Select]
git rebase upstream/master
Resetting

Sometimes, including after a rebase, you need to reset your working tree. You can reset to a particular commit, and delete all changes, with the following command.

Code: [Select]
git reset --hard 1fc6665
To force push your last known non-conflicting commit to the origin repository, you’ll need to use --force.
Code: [Select]
git push --force origin master
To remove local untracked files and subdirectories from the Git directory for a clean working branch, you can use git clean.
Code: [Select]
git clean -f -d
If you need to modify your local repository so that it looks like the current upstream master (that is, there are too many conflicts), you can perform a hard reset.
Code: [Select]
git reset --hard upstream/master
Pages: 1 [2] 3 4 ... 10