JagoanKode Documentation

website·Indexed 30 days ago

https://jagoankode.netlify.app

A collection of technical guides and tutorials covering Linux basic commands, server administration with cPanel/WHM and Proxmox, deployment configurations for Laravel, React, and CodeIgniter 4, and security mitigation strategies including .htaccess filtering and virus cleanup.

Tokens
13.9K
Snippets
129
Records
138
Agent score
73%

What's inside JagoanKode

  1. Introduction to Linux Wildcards (Globbing)

    Wildcards, also known as Globs or glob patterns, are special characters used for pattern matching of file and directory names. Globbing is the process of expanding these wildcards into a list of matching files and directories. Wildcards can be used as arguments in most Linux commands that accept files or directories, such as ls, rm, cp, and mv.
  2. Overview of Docusaurus core features

    Docusaurus is a tool designed for quick installation and deployment of documentation websites. It allows developers to focus on content by placing documentation files in the docs directory and provides the ability to extend or customize website layouts using React while maintaining consistent global elements like headers and footers.
  3. Compile TypeScript server for cPanel deployment

    To compile the backend server for production, create a tsconfig.server.json file to define the compilation targets and output directory. Use the TypeScript compiler (tsc) to generate the JavaScript files in the dist-server directory. If the environment requires a .cjs extension, rename the output file after compilation.
    // tsconfig.server.json
    {
      "compilerOptions": {
        "target": "ES2022",
        "module": "commonjs",
        "outDir": "./dist-server",
        "esModuleInterop": true,
        "skipLibCheck": true,
        "resolveJsonModule": true,
        "allowJs": true
      },
      "include": ["server.ts"]
    }
    # Compile the server
    npx tsc --project tsconfig.server.json
    
    # Compile and rename to .cjs if required
    npx tsc --project tsconfig.server.json && mv dist-server/server.js dist-server/server.cjs
  4. Install Python 2.7 on Enterprise Linux 9 (EL9)

    Install the Python 2.7 (version 2.7.18-30.el9) package on x86_64 Enterprise Linux 9 systems using the yum package manager from the sysadmins.ws repository.
    yum -y install https://pkgs.sysadmins.ws/el9/base/x86_64/python2.7-2.7.18-30.el9.x86_64.rpm
  5. Configure Node.js Application in cPanel

    Set up the Node.js application in cPanel using the 'Setup Node.js App' tool. Ensure the application root and startup file point to the compiled server files. Set the NODE_ENV environment variable to production to ensure the script runs correctly in the production environment.
    Node.js version: 18.x or 20.x
    Application mode: Production
    Application root: /public_html/apps
    Application URL: [your-domain]
    Application startup file: dist-server/server.js
    
    Environment Variable:
    NODE_ENV = production
  6. Search for files and directories using the find command

    The find command searches for files and directories in real-time. If no path is specified, it defaults to the current directory and all its subdirectories. It evaluates the filesystem live, making it suitable for finding files created very recently.
    find [path] [expression]
    
    # Search all files in current directory
    find .
    
    # Search for a specific file by name in a specific path
    find /usr/local -name My.info
  7. Create a symbolic link for Laravel storage

    In Laravel, files stored in storage/app/public are not accessible from the web. You must create a symbolic link from the storage directory to the public directory to make these files accessible. This can be executed via a terminal or a cronjob.
    ln -s /home/user_cpanel/public_html/storage/app/public/ /home/user_cpanel/public_html/public/storage
  8. Remove default Debian 13 kernel

    After installing Proxmox, remove the default Debian kernel to ensure the system boots from the Proxmox kernel.
    # Check current kernel and installed images
    uname -r
    dpkg --list | grep linux-image
    
    # Remove Debian kernel images
    apt remove linux-image-amd64 'linux-image-6.12*'
    apt autoremove --purge -y
    
    # Update grub and reboot
    update-grub
    reboot
  9. Disable cloud-init networking on bare metal

    If the bare metal installation uses cloud-init, you must disable its network configuration to prevent it from overriding manual settings. Copy the contents of /etc/network/interfaces.d/50-cloud-init to /etc/network/interfaces, disable the cloud-init network config, and remove the cloud-init interface file.
    # 1. Copy content from /etc/network/interfaces.d/50-cloud-init to /etc/network/interfaces
    nano /etc/network/interfaces.d/50-cloud-init
    nano /etc/network/interfaces
    
    # 2. Disable cloud-init networking
    nano /etc/cloud/cloud.cfg.d/99-custom-networking.cfg
    # Add the following line to the file:
    # network: {config: disabled}
    
    # 3. Remove the cloud-init network file and reboot
    rm -f /etc/network/interfaces.d/50-cloud-init
    reboot
  10. Use basic wildcards for simple pattern matching

    Linux provides two primary wildcards for basic matching:

    • *: Matches zero or more characters (any sequence of characters).
    • ?: Matches exactly one single character.
    # Find all files ending in .txt
    ls *.txt
    
    # Find all files starting with 'a'
    ls a*
    
    # Find all files starting with 'a' and ending in .txt
    ls a*.txt
    
    # Find files with exactly one character before .txt
    ls ?.txt
    
    # Find files with exactly two characters starting with 'a'
    ls a?