Posts

Showing posts from February, 2021

Linux uses Host Name to connect

Image
  Tested on Ubuntu 20.04. In Windows, the "computer name" can be used for network connection, so no matter how the IP is changed in the local network, the connection setting does not need to be changed.  In Linux, there is the same thing, which is to use Host Name to connect. During the Ubuntu installation process, you will need to fill in the "your computer name". In fact, the Host Name is set, but it cannot be used to connect by default. This article gives examples of two ways to open it: Install Samba Samba is a commonly used communication component with Windows. If you use the nmbd component, it can support NetBIOS to allow various Windows applications to connect without complicated settings.  If you use the Ubuntu desktop, just share any folder and you will be asked if you want to install Samba. Click Yes and you are done. The command installation method is: sudo apt-get install samba This method is easy to use for small offices or small area networks. It shoul

Gradle references the level project

Image
  Gradle is a very powerful tool. Many multi-project management teachings on Gradle on the Internet are not written very complicated, or they are wrong. Suppose we have a main project, lab-springboot, and another parallel sub-project called library1. The main project will call the sub-project's library. The directory structure is as follows and can be placed in any directory: lab-springboot library1 This tutorial demonstrates how to use eclipse to create a Gradle project with such a structure. First, add a SpringBoot project. Of course, eclipse must have Spring related toolchain installed. Select Spring Boot→Spring Starter Project, and select Gradle as Type: Next, add a sub-project library1, select Gradle→Gradle Project: After the construction is completed, eclipse will display two projects, which are also equal in the physical save path. Change Library.java in library1 and change someLibraryMethod to static. public class Library { public static boolean someLibraryMethod() {

Gradle dependency (dependency) configuration

  Dependency configurations (dependency configurations), or dependencies, the Java plugin dependency management in Gradle is the part that must be understood.  There are a few common ones: The compile project needs the content of these dependent libraries at the compile stage, which includes the sub-dependencies of the dependent libraries, and these content will eventually be added to the classpath.  For example, Spring and Hibernate's dependent libraries. Runtime inherits compile.  These dependent libraries are needed when the project is executed.  For example, the dependency library of MySQL driver.  Remarks: Suppose the project uses a dependency A, and A is dependent on B?, only A is needed in the compilation phase of the project, but A and B are actually needed in the execution phase. This is why the dependencies of the configuration compile can be seen by the runtime, but the reverse Not necessarily correct. compileOnly inherits compile.  These dependent libraries are basicall

WordPress easy to generate static website plug-in

Image
  Some people use Static CMS to design things like Jekyll and Hexo, but almost none of these things have more user-friendly content editors, such as powerful things like Divi, so there is another trick, which is to edit the website with WordPress. , And then use some static generators to generate static websites. There is a set of the simplest and most effective to try: Simply Static. After installation, select "Save for offline use" in Settings and "Temporary Files Directory" in Advanced settings to set the path to be exported. The permissions of the path must be readable and writable.  Then you can go to Generate and click "Generate Static Files". The set path may not allow you to click URL download directly, you can download it in other ways, or write an automatic sftp transmission to other places. After testing, the plug-in can normally produce the design and layout edited by Divi.

Linux Command Pipeline basic teaching

  The "command pipeline" (command pipeline) is a very powerful basic feature of the Linux ecosystem. It can cascade a variety of different commands and turn many basic commands into a programmable way to use, which is of great help in the operation of the system. When a general Linux command is executed, there will be three input and output data streams, namely: Standard input (code 0): input data required for program execution. Standard output (code 1): The output data produced by the normal execution of the program. Standard error output (code 2): A message used to notify the user when a program error occurs, or a message used to present the program status. When the Linux program is running, it looks like this: Standard input STDIN ==> Linux program ==> Standard output STDOUT ==> Standard error output STDERR We can use the redirection feature to change the flow of these data, and add a pipe to string together different Linux programs. Pipe Connect the input and out

Ubuntu configures SSH Server to allow users to log in from outside

Image
  The teaching passed the test on Ubuntu 20.04. When I just installed Ubuntu Desktop, I found that I could not log in from the outside with SSH. The main reason was that SSH Server was not installed and configured. installation Inspection kit: dpkg -l | grep ssh Sure enough, there is no SSH Server. installation: sudo apt-get install openssh-server Check again, add -server and sft-server, there are! Configuration To configure SSH Server so that he can log in using SSH Key from Windows. Many teachings here are very confusing, mainly because the key configuration is very abstract to many people. Remember, the logged-in end is only Public Key is required, and Private Key is required only at the end that requires login. Here we assume that the Private Key has been generated with Putty and saved as a .ppk file name.  First open the Private Key with PuTTYgen, and then Save the public key. The extension is whatever you want. You don't need to use it. In fact, the key is just a string that

Linux uses NVM to manage Nodejs

  Since Nodejs is an ecosystem with great compatibility problems, how to make different versions of Nodejs coexist and manage will be a very important block. NVM is used to deal with this problem. installation First go to the official Github Repo to check the latest version, and remember to replace the command with the latest version. wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash source ~/.bashrc After the installation is complete, check the version. nvm –version List local version nvm ls There should be no Nodejs version when NVM is first installed. List remote installable versions It is recommended to install LTS for the newer versions. For some old applications, only certain old versions can be executed and must be downloaded. nvm ls-remote Install the specified version Will automatically download and install the specified node version from the remote. nvm install v12.20.2 Use node -v to check the version after installation. Use specified version Y

Oracle Cloud Ubuntu VPS firewall settings

Image
  After installing nginx on the Oracle VPS under Ubuntu, you will find that the default port 80 cannot be connected from the static ip, which is mainly blocked by two different levels of firewalls: VM Instance <==[ Ubuntu firewall]==> Virtual cloud Network <==[ Oracle firewall]==> Browser Oracle firewall Log in to the management interface https://cloud.oracle.com/ Open Virtual Colud Networks under Networking. After you enter all the way, there will be a new Ingress Rule place. Use this to open the port, you can set multiple ports at once, here is set 0.0.0.0/0, any source can access tcp: 80. Ubuntu firewall The ubuntu image provided by Oracle has also been used as a firewall, mainly to defend against virtual area network attacks and get through manually. Change to the root account: sudo -i Check the network card name: ip addr show Open port 80, the network card name in this example is ens3: sudo iptables -I INPUT 5 -i ens3 -p tcp --dport 80 -m state --state NEW,ESTABLISHED