Tag Archives: Linux

Installation of Linux system error: no default or UI configuration directive found solution

Geeks, please accept the hero post of 2021 Microsoft x Intel hacking contest>>>

installation of Linux system error: no default or UI configuration directive found solution

Reference article:

(1) Installation of Linux system error: no default or UI configuration directive found solution

(2) https://www.cnblogs.com/itcx/p/4288468.html

Let’s make a note.

Run jar file under Linux system, prompt: no main manifest attribute, in xxx.jar [How to Solve]

When executing Java – jar xxx.jar com.helloworld under Linux system, you will often be prompted: no main manifest attribute, in xxx.jar

The reasons are as follows:

Normally, when Java is packaged as a jar package, you need to specify the main class item in manifest.mf to find the corresponding main class when running Java – jar xxx.jar. Because – jar means that the following jar package has a main class to run independently, you need to specify this class when you package it into a jar package

If you want to specify the class you want to run at runtime, you should use – CP/– classpath to specify it. The command is as follows:
for example: Java – CP xxx.jar com.helloworld

Packaging can also be specified in the following way to directly run the jar file Java – jar XXX. Jar

<plugins>
    <!-- When packaging the jar file, configure the manifest file and add the jar dependencies of the lib package -->
    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <version>2.6</version>
        <configuration>
            <classesDirectory>target/classes/</classesDirectory>
            <archive>
                <manifest>
                    <mainClass>com.alibaba.dubbo.container.Main</mainClass>
                    <!-- Timestamped version not recorded in MANIFEST.MF file when packing -->
                    <useUniqueVersions>false</useUniqueVersions>
                    <addClasspath>true</addClasspath>
                    <classpathPrefix>crm-lib/</classpathPrefix>
                </manifest>
                <manifestEntries>
                    <Class-Path>.</Class-Path>
                </manifestEntries>
            </archive>
        </configuration>
    </plugin>
    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <executions>
            <execution>
                <id>copy-dependencies</id>
                <phase>package</phase>
                <goals>
                    <goal>copy-dependencies</goal>
                </goals>
                <configuration>
                    <type>jar</type>
                    <includeTypes>jar</includeTypes>
                    <outputDirectory>
                        ${project.build.directory}/crm-lib
                    </outputDirectory>
                </configuration>
            </execution>
        </executions>
    </plugin>
</plugins>

After installing torch on Linux, an error is still reported: importerror: no module named torch

Geeks, please accept the hero post of 2021 Microsoft x Intel hacking contest>>>

Error still reported after installing torch on Linux:

Traceback (most recent call last):
  File "cifar10_tutorial.py", line 58, in <module>
    import torch
ImportError: No module named torch 

The reason is that you have to configure the environment:

First enter:

vim ~/.bashrc

Add the following statement:

. /home/yourdirectory/torch/install/bin/torch-activate
# added by Anaconda3 installer
export PATH="/home/yourdirectory/anaconda3/bin:$PATH"

Then update the environment variable

source ~/.bashrc

Linux Implement Django Error: nohup: ignoring input and appending output to ‘nohup.out’

1、 Deploying Django to remote Linux server

Using xshell to connect to Linux server through SSH, the normal startup command is

python3 manage.py runserver 0.0.0.0:80

However, after you close xshell, you won’t be able to access Django

Concept: if you are running a process and you feel that the process will not end when you exit the account, you can use the nohup command. This command can continue to run the corresponding process after you exit the account/close the terminal.)

Enter

nohup python3 manage.py runserver 0.0.0.0:80

An error will be reported

nohup: ignoring input and appending output to ‘nohup.out’

2、 Solutions

1. Why

Because using nohup will generate log files, which are written to nohup.out by default

2. Solution

Output the log of nohup to/dev/null, this directory will make all the information to it disappear automatically

nohup python3 manage.py runserver 0.0.0.0:80 > /dev/null 2> /dev/null &

Nodejs throws an error when listening to the port under Linux

june@june-Satellite-C600:~/nodejs/lesson$noderandom.js
RandomNumberGeneratorRunning…

events.js:72
thrower;//Unhandled'error'event
^
Error:listenEACCES
aterrnoException(net.js:904:11)
atServer._listen2(net.js:1023:19)
atlisten(net.js:1064:10)
atServer.listen(net.js:1138:5)
atObject.<anonymous>(/home/june/nodejs/lesson/random.js:50:8)
atModule._compile(module.js:456:26)
atObject.Module._extensions..js(module.js:474:10)
atModule.load(module.js:356:32)
atFunction.Module._load(module.js:312:12)
atFunction.Module.runMain(module.js:497:10)

There are two ways to solve the problem

1:sudo node *.js —–> Root authority solution

2: Set the port number above 1024 in the code; Because Linux monitors & lt; 1024 port needs root permission, > No need

Problems of java.sql.sqlrecoveryexception: IO error: connection reset of ojdbc in Linux Environment

To get to the point, the quickest verification method and solution : Java – DJava. Security. EGD = file:///dev/urandom – jar xxxxxx.jar

Describe the following problem: write a jar tool, use the connection pool, ojdbc. The windows environment is all right. Java.sql.sqlrecoveryexception: IO error: connection reset appears after two or three times of startup and shutdown in Linux environment

Check the configuration file and parsing problem, no result

Using the latest ojdbc package, no results

Change Hikari to Druid, no result

I have no choice but to search and find the above scheme, explaining the reason for this problem:

When connecting to the Oracle server, the client needs to generate a random key for client authentication. Under Linux, JDK uses/dev/random by default. Random uses blocking to generate random numbers. The generation speed is very slow, and the Oracle server will reset actively, An error is reported in alert.log:
tns-12535: TNS: operation timed out
ns secondary err Code: 12606
NT main err Code: 0
NT secondary err Code: 0
NT OS err Code: 0
client address: (address = (Protocol = TCP) (host = 192.168.6.21) (Port = 33460))
warning: inbound connection timed out (ora-3136)

Other solutions:

Edit $Java_ Home/JRE/lib/security/Java. Security changes securerandom. Source = file/dev/random to file/dev/random

Solutions to CP: organizing directory errors in Linux

Solutions to CP: organizing directory errors in Linux

When copying a folder on the same machine in Linux system, the prompt is as follows:
CP: organizing directory ` foldera/’
where foldera is the name of the folder I want to copy. The reason for this warning is that there is a directory under the foldera directory, so it cannot be copied directly

Solution:
use recursive copy and add the – R parameter after CP command, such as:
[ root@localhost Opt] # CP – R foldera folderc
here ‘- R’ stands for recursion

Similarly, the – R parameter should be added when deleting a directory in Linux system. If the directory is empty, it will be deleted directly. If the directory is not empty, it will be deleted in cascade. However, there is also a problem in cascading deletion, that is, if there are many files or subdirectories in the directory, the system will prompt one by one. If you want to delete it without prompt, you can use the RM – RF command. F is the meaning of force, on behalf of forced deletion, no prompt

Draw inferences from one instance:
1. When Chmod grants permissions, you can also use – r if you want to cascade. Note that it is uppercase R

2. The copy command between different machines is: (- r also uses recursive copy)

scp -r [email protected] :/home/mmm/QTest /home/nnn/

SCP – R login right @ a machine IP:/absolute path name of folder/absolute path to copy to B machine

In this way, a folder is copied from machine a to a certain path of machine B

reference: http://www.linuxdiyf.com/linux/16778.html

When Linux runs SHELL file, $’\ R’: command not found appears

When running the written shell script, the error prompt $'\ \ R': command not found appears

The reason for the error is that when we operate in Windows system, the newline character in the editor is \\\\\\\\\\\\\\\\\

There are two ways to deal with it

1. VI command to enter the file to be edited, press ESC key to enter the command mode, execute the following command, press enter key, and then save to exit the file

: set ff=unix

2. The second kind

yum -y install dos2unix
dos2nuix install.sh

The above install. SH is the script you wrote. Use dos2nuix to process the files

Linux Install Tomcat Error: service tomcat does not support chkconfig

Installing Tomcat under Linux

 1 //Decompress
 2 # tar zxvf apache-tomcat-7.0.92.tar.gz
 3 // Copy to the init.d directory
 4 # cp -p /usr/tomcat/apache-tomcat-7.0.92/bin/catalina.sh /etc/init.d/tomcat
 5 # chmod 755 /etc/init.d/tomcat 
 6 # chkconfig --add tomca
 7 //add tomcat and java directories
 8 # vim /etc/init.d/tomcat
 9 // finally start tomcat directly
10 # chkconfig tomcat on
11 # service tomcat start

Copy catalina.sh to the init. D directory to ensure that Tomcat can be started anywhere. Use service Tomcat start to start Tomcat more conveniently

Problems:

service tomcat does not support chkconfig

Add:

#chkconfig:2345 10 90

And Java_ Home and Catalina_ Home address, here I am:

JAVA_HOME=/usr/java/jdk1.8.0_191/
CATALINA_HOME=/usr/tomcat/apache-tomcat-7.0.92

Renewal operation:

#chkconfig –add tomcat

About Oct

Under Linux, Ping: SendTo: network is unreachable appears

A super detailed tutorial: springboot integrates mybatis plus>>>

Problem: Ping external network appears:

     sendto: Network is unreachable

View:

    #route

Route command: you can use the route command to view the routing table when the packet is not delivered effectively

[root@tiny4412:/]#route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.1.0     *               255.255.255.0   U     0      0        0 eth0

Found that there is no gateway configured due to the gateway

Solution:

   

[root@tiny4412:/]#route add default gw 192.168.1.1
[root@tiny4412:/]#route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         192.168.1.1     0.0.0.0         UG    0      0        0 eth0
192.168.1.0     *               255.255.255.0   U     0      0        0 eth0

Test:

[root@tiny4412:/]#ping 119.75.217.56
PING 119.75.217.56 (119.75.217.56): 56 data bytes
64 bytes from 119.75.217.56: seq=0 ttl=50 time=20.468 ms
64 bytes from 119.75.217.56: seq=1 ttl=50 time=19.113 ms
64 bytes from 119.75.217.56: seq=2 ttl=50 time=18.814 ms
64 bytes from 119.75.217.56: seq=3 ttl=50 time=18.906 ms
64 bytes from 119.75.217.56: seq=4 ttl=50 time=18.859 ms
64 bytes from 119.75.217.56: seq=5 ttl=50 time=18.704 ms
64 bytes from 119.75.217.56: seq=6 ttl=50 time=19.050 ms
64 bytes from 119.75.217.56: seq=7 ttl=50 time=20.514 ms
64 bytes from 119.75.217.56: seq=8 ttl=50 time=21.355 ms
^C
--- 119.75.217.56 ping statistics ---
9 packets transmitted, 9 packets received, 0% packet loss
round-trip min/avg/max = 18.704/19.531/21.355 ms