Tag Archives: Linux

How to Share Files Between Linux and windows

1. Create users, directories and installation packages
yum install samba smbfs
useradd -s /sbin/nologin yunwei
smbpasswd -a yunwei
mkdir -p /date/yunwei
chmod 777 /data/yunwei
2. Configuration file
cp /etc/samba/smb.conf /etc/samba/smb.confbak
vi /etc/samba/smb.conf
[homes]
comment = Home Directories
valid users = %S
browseable = No
writable = yes
create mode = 0664
directory mode = 0775

[yunwei]
comment = yunwei
path = /data/yunwei
public = no
valid users = @yunwei
write list = yunwei
printable = no

3. Start the service
Red Hat Enterprise Linux Server release 6.4 (Santiago)
/etc/init.d/smb start
service smb reload
linux 7
systemctl start smb
systemctl status smb
4. Test the use of
windows => run =>
\\ip\yunwei

[Solved] Using jdk11 to deploy Nacos under Linux, the startup error is: could not find or load main class

Deploying Nacos using jdk11 under Linux

Error log

/nacos/jdk-11.0.12/bin/java   -server -Xms2g -Xmx2g -Xmn1g -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=320m -XX:-OmitStackTraceInFastThrow -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/nacos/nacos-server-2.0.3-node1/logs/java_heapdump.hprof -XX:-UseLargePages -Dnacos.member.list= -Xlog:gc*:file=/nacos/nacos-server-2.0.3-node1/logs/nacos_gc.log:time,tags:filecount=10,filesize=102400 -Dloader.path=/nacos/nacos-server-2.0.3-node1/plugins/health,/nacos/nacos-server-2.0.3-node1/plugins/cmdb -Dnacos.home=/nacos/nacos-server-2.0.3-node1 -jar /nacos/nacos-server-2.0.3-node1/target/nacos-server.jar  --spring.config.additional-location=file:/nacos/nacos-server-2.0.3-node1/conf/ --logging.config=/nacos/nacos-server-2.0.3-node1/conf/nacos-logback.xml --server.max-http-header-size=524288
Error: Could not find or load main class 
Caused by: java.lang.ClassNotFoundException: 

Solution:

In the Nacos-Server bin/startup.sh
Startup error caused by JAVA_OPT_EXT_FIX configuration

Replace the following configuration in the startup.sh file

x JAVA_OPT_EXT_FIX="-Djava.ext.dirs=${JAVA_HOME}/jre/lib/ext:${JAVA_HOME}/lib/ext"
√ JAVA_OPT="${JAVA_OPT} -Djava.ext.dirs=${JAVA_HOME}/jre/lib/ext:${JAVA_HOME}/lib/ext"

x echo "$JAVA $JAVA_OPT_EXT_FIX ${JAVA_OPT}"
√ echo "$JAVA ${JAVA_OPT}"

x echo "$JAVA $JAVA_OPT_EXT_FIX ${JAVA_OPT}" > ${BASE_DIR}/logs/start.out 2>&1 &
x nohup "$JAVA" "$JAVA_OPT_EXT_FIX" ${JAVA_OPT} nacos.nacos >> ${BASE_DIR}/logs/start.out 2>&1 &
√ echo "$JAVA ${JAVA_OPT}" > ${BASE_DIR}/logs/start.out 2>&1 &
√ nohup $JAVA ${JAVA_OPT} nacos.nacos >> ${BASE_DIR}/logs/start.out 2>&1 &

Rabbitmq error of connecting the native idea to Linux: java.net.connectexception: connection timed out: Connect [Solved]

The code is as follows:

        ConnectionFactory connectionFactory = new ConnectionFactory();
        connectionFactory.setHost("192.168.2.135");
        connectionFactory.setPort(5672);
        connectionFactory.setUsername("admin");
        connectionFactory.setPassword("admin");
        connectionFactory.setVirtualHost("/");

        Connection connection=null;
        Channel channel = null;

        try {
            //2.create linke Connection
            connection = connectionFactory.newConnection("Creator");

Error: Java. Net. Connectexception: connection timed out: connect

Cause analysis: first, the IP port account and password are excluded

Error reason: port 5672 is not open. I always thought that everything would be fine as long as the protective wall was closed

Solution:

1. Restart the firewall: systemctl start firewall

2. Open 5672 port: firewall CMD — zone = public — add port = 5672/TCP — permanent

3. Reload: firewall CMD — reload

Run debug:

success!!!

Linux error: command not found [How to Solve]

I saw a fun project some time ago: [musicbox]( https://github.com/darknessomi/musicbox )Start installing with git clone, and the input command cannot be run. At first, I thought there was a problem with the installation, so I changed to PIP installation. I found that it still couldn’t run
interface error: command not found

At first I wondered why I couldn’t find the order?After searching, it is found that the commands viewed by Linux must be placed in/usr/bin /. If they are not in this directory, they will not be found
at this time, we need to create a link file for these commands that cannot be found. Link it to/usr/bin to directly execute our commands

Establishing a soft link is equivalent to establishing a shortcut:

1、Want to see where the installation directory is
find/-name musicbox

2、Create a soft link
ln -s /usr/local/musicbox/bin/musicbox    /usr/bin

 

After doing the above operations, you can find the corresponding command

How to Solve Linux Error: ifconfig command not found

1. An error is reported when inputting ifconfig command in Linux: ifconfig command not found

Ifconfig may not be installed. If not, install it

2. Check if ifconfig is missing. It is in/usr/SBIN directory

root@localhost ~]#Ll/usr/SBIN

check if there is ifconfig

if there is no ifconfig, install the net tools package

[ root@localhost sbin]# sudo yum install net-tools

 

Linux: How to Solve Git clone error

How to Solve Error: error: The requested URL returned error: 401 Unauthorized while accessing

Problem:

Error: error: The requested URL returned error: 401 Unauthorized while accessing
git version1.7.1

Solution 1: Assign a user
git clone https://github.com/org/project.git

change to
git clone https://[email protected]/org/project.git
or
git clone https://username:[email protected]/org/project.git

If it appears in push or pull, then you need to change the remote address
git remote set-url origin https://[email protected]/org/project.git

Solution 2: Remove validation
git config -global http.sslverify false

Solution 3: (recommended)
Upgrade git version ≥ 1.7.10

Solution 4:
Add ssh secret key

 

Ifconfig command not found for Linux Installation Errors [How to Solve]

Problem Description:

Install Linux system with virtual machine VMware (the image file is centos-7.0-1406-x86 downloaded from the official website_64-DVD.iso),

After the installation is completed, enter the ifconfig command and an error is reported: ifconfig command not found

Solution:

1 determine whether ifconfig is not installed. If not, add it

2 determine whether it is not added to the environment variable. If not, add it

Solution:

First determine if ifconfig is missing, it is in the /sbin directory




[root@localhost ~]# cd /sbin
[root@localhost sbin]# ls

Check to see if ifconfig is present


If you don't have ifconfig, install net-tools package


[root@localhost sbin]# sudo yum install net-tools

Of course, if ifconfig already exists in the specified directory, it may also be caused by other problems, such as the environment variable is not added:

 

The original use ifconfig can be used, today is how, may be the installation software modified, Baidu ~ ~

[oracle@localhost /]$ ifconfig 
prompt: "bash: ifconfig: command not found" 
So I switched to the root user 
[root@localhost /]$ ifconfig 
It still says: "bash: ifconfig: command not found" 
Analyze the problem 
1. whereis ifconfig to see which directory the command is in 
2. echo $PATH to see if the directory is under the scrip, note that lunux is completely case-sensitive, so do not ignore this point 
3. Execute the command, you need to specify the path or add the directory to the PATH 
4. Then you can access it like this 
Method 1: [root@localhost sbin]$ /sbin/ifconfig can appear to use 
Method 2: [root@localhost sbin]$ export PATH=$PATH:/sbin , after setting this, you can access it directly next time, avoiding the trouble of the first one, such as: [root@localhost sbin]$ export PATH=$PATH:/sbin 
[root@localhost /]$ ifconfig 
Method 3: Modify the /etc/profile file, comment out the if statement 
Comment out the following if statement. 
# Path manipulation 
if [ "$EUID" = "0" ]; then 
pathmunge /sbin 
pathmunge /usr/sbin 
pathmunge /usr/local/sbin 
fi 
Modify to 
# Path manipulation 
# if [ "$EUID" = "0" ]; then 
pathmunge /sbin 
pathmunge /usr/sbin 
pathmunge /usr/local/sbin 
#fi 
Note: It is not only the ifconfig command that gives "bash: ifconfig: command not found", because the non-root user does not have /sbin/ifconfig in his path.

If the command "bash: ifconfig: command not found" is not only for ifconfig command, but also for other commands, the solution is the same. 

Linux Install Error: pkg-config not found [How to Solve]

Linux Installation Error: PKG config not found


When using compile to install, the following error occurs when executing./configure:

...
...
checking for pkg-config... no
pkg-config not found
configure: error: Please reinstall the pkg-config distribution

Prompt: configuration error, please reinstall PKG configuration distribution

Solution: according to the prompt, install PKG config:

sudo apt-get install pkg-config

Expand knowledge:

About PKG config:

pkg-config is a helper tool used when compiling applications and libraries. It helps you insert the correct compiler options on the command line so an application can use gcc -o test test.c `pkg-config –libs –cflags glib-2.0` for instance, rather than hard-coding values on where to find glib (or other libraries). It is language-agnostic, so it can be used for defining the location of documentation tools, for instance.