Category Archives: Linux

Linux use the man command error: Man: command not found [How to Solve]

 

# Check this environment variable with echo $PATH. This problem is usually a matter of the environment variable PATH being incorrect.
[root@localhost ~]# echo $PATH

# Use the whereis command to see, where this command is located.
[root@localhost ~]# whereis man

# Use that address directly, or add that path to PATH. There are two ways to add the PATH environment variable.
# Method 1: PATH disappears when the terminal is closed.
[root@localhost ~]# export PATH=/usr/local/webserver/mysql/bin:$PATH
# Method 2: Change PATH by editing /etc/profile, you can also change .bashrc in your home directory (i.e. ~/.bashrc).
[root@localhost ~]# vim /etc/profile
[root@localhost ~]# export PATH="/usr/local/webserver/mysql/bin:$PATH"
[root@localhost ~]# source /etc/profile

 

Error in make menuconfig on Ubuntu [How to Solve]

If you use make menuconfig to configure the kernel, and it happens that the ncurses library is not installed in the system (this library is not installed by default in the Ubuntu system), an error will occur. The error message is as follows:

*** Unable to find the ncurses libraries or the
*** required header files.
*** 'make menuconfig' requires the ncurses libraries.
***
*** Install ncurses (ncurses-devel) and try again.
***
make[1]: *** [scripts/kconfig/dochecklxdialog] Error 1
make: *** [menuconfig] Error 2


The solution is as simple as installing the ncurses library, which can be done on ubuntu/debian systems with the following command.

$sudo apt-get install libncurses5-dev

Ncurses library is the basic library for screen control under character terminal, and many newly developed programs may not be used, but it is often used when compiling some old programs

How to Solve Redis Error: /bin/sh: cc: command not found

 

[root@hadoop01 redis-3.0.0]# make
cd src && make all
make[1]: Entering directory `/usr/local/redis-3.0.0/src'
rm -rf redis-server redis-sentinel redis-cli redis-benchmark redis-check-dump redis-check-aof *.o *.gcda *.gcno *.gcov redis.info lcov-html
(cd ../deps && make distclean)
make[2]: Entering directory `/usr/local/redis-3.0.0/deps'
(cd hiredis && make clean) > /dev/null || true
(cd linenoise && make clean) > /dev/null || true
(cd lua && make clean) > /dev/null || true
(cd jemalloc && [ -f Makefile ] && make distclean) > /dev/null || true
(rm -f .make-*)
make[2]: Leaving directory `/usr/local/redis-3.0.0/deps'
(rm -f .make-*)
echo STD=-std=c99 -pedantic >> .make-settings
echo WARN=-Wall -W >> .make-settings
echo OPT=-O2 >> .make-settings
echo MALLOC=jemalloc >> .make-settings
echo CFLAGS= >> .make-settings
echo LDFLAGS= >> .make-settings
echo REDIS_CFLAGS= >> .make-settings
echo REDIS_LDFLAGS= >> .make-settings
echo PREV_FINAL_CFLAGS=-std=c99 -pedantic -Wall -W -O2 -g -ggdb   -I../deps/hiredis -I../deps/linenoise -I../deps/lua/src -DUSE_JEMALLOC -I../deps/jemalloc/include >> .make-settings
echo PREV_FINAL_LDFLAGS=  -g -ggdb -rdynamic >> .make-settings
(cd ../deps && make hiredis linenoise lua jemalloc)
make[2]: Entering directory `/usr/local/redis-3.0.0/deps'
(cd hiredis && make clean) > /dev/null || true
(cd linenoise && make clean) > /dev/null || true
(cd lua && make clean) > /dev/null || true
(cd jemalloc && [ -f Makefile ] && make distclean) > /dev/null || true
(rm -f .make-*)
(echo "" > .make-ldflags)
(echo "" > .make-cflags)
MAKE hiredis
cd hiredis && make static
make[3]: Entering directory `/usr/local/redis-3.0.0/deps/hiredis'
gcc -std=c99 -pedantic -c -O3 -fPIC  -Wall -W -Wstrict-prototypes -Wwrite-strings -g -ggdb  net.c
make[3]: gcc:command cannot found
make[3]: *** [net.o] error 127
make[3]: Leaving directory `/usr/local/redis-3.0.0/deps/hiredis'
make[2]: *** [hiredis] error 2
make[2]: Leaving directory `/usr/local/redis-3.0.0/deps'
make[1]: [persist-settings] error 2 (igorne)
    CC adlist.o
/bin/sh: cc: command not found
make[1]: *** [adlist.o] error 127
make[1]: Leaving directory `/usr/local/redis-3.0.0/src'
make: *** [all] error 2

prompt GCC and CC command not found

Solutions

yum -y install gcc gcc-c++ libstdc++-devel

Bash: lspci: command not found solution

In CentOS virtual machine makes lspci to view hardware information. When using it, it prompts bash: lspci: command not found, most use /sbin/lspci to do this, I found that it is not available under /sbin on my system either. Using yum install lspci shows no such package.

#yum whatprovides */lspci

pciutils-3.1.4-9.el6.x86_64 : PCI bus related utilities

Repo : base

Matched from:

Filename : /sbin/lspci

#yum install pciutils

After installation, you can use lspci

[root@GoGo ~]# lspci

00:00.0 Host bridge: Intel Corporation 440BX/ZX/DX – 82443BX/ZX/DX Host bridge (rev 01)

00:01.0 PCI bridge: Intel Corporation 440BX/ZX/DX – 82443BX/ZX/DX AGP bridge (rev 01)

00:07.0 ISA bridge: Intel Corporation 82371AB/EB/MB PIIX4 ISA (rev 08)

00:07.1 IDE interface: Intel Corporation 82371AB/EB/MB PIIX4 IDE (rev 01)

00:07.3 Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ACPI (rev 08)

yum whatprovides reverse check which installation the command is in

yum whatprovides */command name

For example, to find which installer provides pvcreate.

yum whatprovides */pvcreate

[Solved] Cannot use lsof command “- bash: lsof: command not found” in centos6

1. Problem Description
Under centos, the command lsof cannot be used, and the following message appears:
# lsof -i:3690
-bash: lsof: command not found
2. Solution
We can install it via yum:
# yum install lsof
I will do the following:
# yum install lsof
Loaded plugins: fastestmirror
Setting up Install Process
Loading mirror speeds from cached hostfile
* base: mirrors.163.com
* epel: ftp.cuhk.edu.hk
* extras: mirrors.aliyun.com
* updates: mirrors.163.com
Resolving Dependencies
–> Running transaction check
—> Package lsof.x86_64 0:4.82-4.el6 will be installed
–> Finished Dependency Resolution

Dependencies Resolved

================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
lsof x86_64 4.82-4.el6 base 319 k

Transaction Summary
================================================================================
Install 1 Package(s)

Total download size: 319 k
Installed size: 890 k
Is this ok [y/N]: y
Downloading Packages:
lsof-4.82-4.el6.x86_64.rpm | 319 kB 00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : lsof-4.82-4.el6.x86_64 1/1
Verifying : lsof-4.82-4.el6.x86_64 1/1

Installed:
lsof.x86_64 0:4.82-4.el6

Complete!
3. Some common commands of lsof
lsof -i:(port number)
For example,
lsof -i:3306 (3306 is the port of mysql server by default)
lsof -i:3690 (3690 is the default port for the svn server)

OK, Enjoy it!!!

Ubuntu Error: No module named ‘apt_pkg’ (Step-by-Step Tutorial)

 

Ubuntu often uses the following command to add PPA sources:

sudo add-apt-repository ppa:XXX

Error: no module named ‘apt’_ pkg’ 。

This problem has been bothering me for a long time. Every time I want to solve it, I have been busy on the Internet for a long time without finding a solution

today I found the solution

 

Step 1: sudo GEDIT/usr/bin/apt add repository

We will find that the so-called “apt add repository” command is actually a python script, and the top line reads: #/ usr/bin/python3

This is a python 3 script

Step 2: sudo LS – L/usr/bin/python3

Display/usr/bin/python3 – > python3.5

Explain that on my Ubuntu, python3 is linked to python3.5. That’s the problem with Python 3.5

Step 3:

cd /usr/lib/python3/dist-packages/

ls apt_ pkg*

Display: apt_ pkg.cpython-34m-x86_ 64-linux-gnu.so

Note the word 34m, which means that only Python 3.4 can use this component safely! But our computer python3 is linked to python3.5

different Ubuntu versions do not necessarily display 34m, so you must check this file yourself. Then modify python3 to link to the corresponding version

At this point, the solution is very simple

Step 4:

sudo rm /usr/bin/python3

sudo ln – S/usr/bin/python3.4/usr/bin/python3 (according to the file name and version)

It’s done! Go and see if the apt add repository command can be used

The ultimate mystery

sudo apt-get remove –purge python-apt

sudo apt-get install python-apt -f

sudo find/-name “apt_ pkg.cpython-35m-x86_ 64-linux-gnu.so”

cd /usr/lib/python3/dist-packages/

sudo cp apt_ pkg.cpython-35m-x86_ 64-linux-gnu.so apt_ pkg.cpython-36m-x86_ 64-linux-gnu.so (depending on the file name version)

[Solved] Idea service startup error: no buffer space available (maximum connections reached): the solution of connect.

Error message.
Severe : Error starting endpoint
java.io.IOException: Unable to establish loopback connection
at sun.nio.ch.PipeImplInitializer.run(PipeImpl.java:106)atjava.security.AccessController.doPrivileged(NativeMethod)atsun.nio.ch.PipeImpl.&lt;init>(PipeImpl.java:122)atsun.nio.ch.SelectorProviderImpl.openPipe(SelectorProviderImpl.java:27)atjava.nio.channels.Pipe.open(Pipe.java:133)atsun.nio.ch.WindowsSelectorImpl.&lt;init>(WindowsSelectorImpl.java:104)atsun.nio.ch.WindowsSelectorProvider.openSelector(WindowsSelectorProvider.java:26)atjava.nio.channels.Selector.open(Selector.java:209)atorg.apache.tomcat.util.net.NioEndpoint Initializer.run(PipeImpl.java:106) at java.security.AccessController.doPrivileged(Native Method) at sun.nio.ch.PipeImpl.&lt;init&>(PipeImpl.java:122) at sun.nio.ch.SelectorProviderImpl.openPipe(SelectorProviderImpl.java:27) at java.nio.channels.Pipe.open(Pipe.java:133) at sun.nio.ch.WindowsSelectorImpl.&lt;init&>(WindowsSelectorImpl.java:104) at sun.nio.ch.WindowsSelectorProvider.openSelector(WindowsSelectorProvider.java:26) at java.nio.channels.Selector.open(Selector.java:209) at org.apache.tomcat.util.net.NioEndpointInitializer.run(PipeImpl.java:106)atjava.security.AccessController.doPrivileged(NativeMethod)atsun.nio.ch.PipeImpl.<init>(PipeImpl.java:122)atsun.nio.ch.SelectorProviderImpl.openPipe(SelectorProviderImpl.java:27)atjava.nio.channels.Pipe.open(Pipe.java:133)atsun.nio.ch.WindowsSelectorImpl.<init>(WindowsSelectorImpl.java:104)atsun.nio.ch.WindowsSelectorProvider.openSelector(WindowsSelectorProvider.java:26)atjava.nio.channels.Selector.open(Selector.java:209)atorg.apache.tomcat.util.net.NioEndpointPoller.(NioEndpoint.java:1472)
at org.apache.tomcat.util.net.NioEndpoint.start(NioEndpoint.java:929)
at org.apache.coyote.http11.Http11NioProtocol.start(Http11NioProtocol.java:168)
at org.apache.catalina.connector.Connector.start(Connector.java:1220)
at org.apache.catalina.core.StandardService.start(StandardService.java:540)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:759)
at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Caused by: java.net.SocketException: No buffer space available (maximum connections reached?): connect
at sun.nio.ch.Net.connect(Native Method)
at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:532)
at java.nio.channels.SocketChannel.open(SocketChannel.java:146)
at sun.nio.ch.PipeImpl$Initializer.run(PipeImpl.java:78)
… 20 more
2018-8-20 10:00:21 org.apache.catalina.core.Sta

This is part of the error message, and there is a large string in front of it that is omitted here.

Solution.
This problem has been bothering me for a long time. As soon as tomcat starts, it starts reporting this error. The site could not be accessed. Many people on the Internet said to close the firewall or something, reinstall jdk what have tried, useless. In fact, a careful look at the error log, said: No buffer space available Think about what should be the window in the large link is not closed to cause a lack of space. Check, sure enough, the process is over, but still after a lot of TIME_WAIT state connections are not released, and then check all the time_wait connections.

Solution process.
1. cmd->regedit Enter the registry

2. Go to HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services/Tcpip/Parameters

3. Create a new DWORD type of registry entry, named: MaxUserPort

4. value data (double-click MaxUserPort prompt to enter the value): 60000 (entered in decimal format, the valid range of this value is 5000-65534)

5. Create a new DWORD type registry entry named: TCPTimedWaitDelay

6. value data: 30 (automatic disconnection time of TIME_WAIT, the default is 4 minutes).

Through the above steps, restart tomcat. problem does not recur, happy !!!!

Conclusion.
Due to a large number of TIME_WAIT connections not being released, the occupied port resources have not been reclaimed and the problem of insufficient buffer space has arisen, and the application is always automatically disconnected.