Setting Up a Domain xxx.local in Windows Server 2019


Initial Setup

  1. Install Active Directory Domain Services (AD DS)
  • Open Server Manager.
  • Click Manage, then select Add Roles and Features.
  • Follow the wizard, selecting Role-based or feature-based installation.
  • Select your server, then check Active Directory Domain Services in the roles list.
  • Click Next until completion, then click Install.

2. Configure Active Directory

  • After installation, open Server Manager, click the yellow warning sign at the top, and choose Promote this server to a domain controller.
  • Select Add a new forest and input your domain name, e.g., xxx.local.
  • Set the DSRM (Directory Services Restore Mode) password.
  • Follow the wizard to complete the setup and click Install.

3. Verify Installation

  • The server will restart automatically after installation. Post-restart, check the domain services’ status in Server Manager to ensure everything is running smoothly.

Additional Configuration

  1. DNS Configuration
  • DNS is usually auto-configured with Active Directory. Ensure it correctly resolves names within the domain.

2. Creating User and Computer Accounts

  • Open Active Directory Users and Computers.
  • For users: Right-click your domain (e.g., xxx.local) and select New > User.
  • For computers: Find or create an Organizational Unit (OU), right-click, and select New > Computer.

3. Configuring Group Policy

  • Open Group Policy Management.
  • Right-click on your domain or specific OU, and select Create a GPO in this domain, and Link it here.
  • Name the new GPO and click OK.
  • Right-click the new GPO and select Edit to open the Group Policy Editor.
  • Configure settings under Computer Configuration and User Configuration as needed.
  • Close the editor when done. Apply the new policy during the next refresh cycle or use gpupdate /force.

4. Joining Computers to the Domain

  • On each computer, open System Properties, click Change settings and join the domain under the Computer Name tab.

5. Setting Up Shares and Permissions

  • Set up file shares on the server and configure appropriate access permissions.

6. Security Configuration and Monitoring

    • Regularly update and maintain the server for security.
    • Monitor network activity and logs for system stability.

    Enable Wi-Fi on Windows Server 2019

    PS C:\Users\Administrator> Get-WindowsFeature *Wireless*
    
    Display Name Name Install State
    ------------ ---- -------------
    [X] Wireless LAN Service Wireless-Networking Installed
    
    PS C:\Users\Administrator> Install-WindowsFeature -Name Wireless-Networking
    
    Success Restart Needed Exit Code Feature Result
    
    shutdown –f –r –t 0
    
    PS C:\Users\Administrator> Set-Service WlanSvc -startuptype automatic -passthru
    
    Status Name DisplayName
    ------ ---- -----------
    Running WlanSvc WLAN AutoConfig
    
    PS C:\Users\Administrator> Start-Service WlanSvc -PassThru
    
    Status Name DisplayName
    ------ ---- -----------
    Running WlanSvc WLAN AutoConfig
    

    How to Replace an EC2 Instance’s Volume with One Created from a Snapshot

    Preparatory Steps:

    1. Identify the Desired Snapshot:

    • a. Navigate to the EC2 Dashboard in the AWS Management Console.
    • b. Click on “Snapshots” in the left navigation pane.
    • c. Sort snapshots by creation time/date to locate the snapshot you want to use.

    2. Determine the Corresponding Volume:

    • a. From the selected snapshot’s details, identify the source volume ID or any other relevant volume information.

    3. Locate the Associated EC2 Instance:

    • a. With the volume information from the previous step, go to “Volumes” in the left pane.
    • b. Locate the volume and check its “Attachment Information” column. This will display the instance ID with which the volume is associated.

    4. Document the Pairing:

    • Create a table or list documenting the Snapshot ID, Volume ID, and corresponding Instance ID for streamlined operations. eg:
      • snap-XXXXXXX 500 GiB 20230530 Standard Completed 2023/05/30 09:48 GMT+9 Available (100%) vol-XXXXXXX i-XXXXXXX (ubuntu-XXX-node3): /dev/sda1 (attached)
      • snap-XXXXXXX 1024 GiB 20230530 Standard Completed 2023/05/30 09:48 GMT+9 Available (100%) vol-XXXXXXX i-XXXXXXX (ubuntu-XXX-node3): /dev/sdb (attached)
      • snap-XXXXXXX 500 GiB 20230530 Standard Completed 2023/05/30 09:47 GMT+9 Available (100%) vol-XXXXXXX i-XXXXXXX (ubuntu-XXX-node1): /dev/sda1 (attached)
      • snap-XXXXXXX 500 GiB 20230530 Standard Completed 2023/05/30 09:47 GMT+9 Available (100%) vol-XXXXXXX i-XXXXXXX (ubuntu-XXX-node2): /dev/sda1 (attached)
      • snap-XXXXXXX 200 GiB 20230530 Standard Completed 2023/05/30 09:47 GMT+9 Available (100%) vol-XXXXXXX i-XXXXXXX (ubuntu-XXX-Admin): /dev/sda1 (attached)
      • snap-XXXXXXX 1024 GiB 20230530 Standard Completed 2023/05/30 09:47 GMT+9 Available (100%) vol-XXXXXXX i-XXXXXXX (ubuntu-XXX-node1): /dev/sdb (attached)
      • snap-XXXXXXX 1024 GiB 20230530 Standard Completed 2023/05/30 09:47 GMT+9 Available (100%) vol-XXXXXXX i-XXXXXXX (ubuntu-XXX-node2): /dev/sdb (attached)

    Main Steps:

    5. Create a New Volume from the Snapshot:

    • a. In the left navigation pane, click on “Snapshots.”
    • b. Select the snapshot you want to create a volume from.
    • c. Choose “Actions” and then “Create Volume.”
    • d. Configure the volume settings. Ensure the volume is in the same availability zone as the EC2 instance.
    • e. Click “Create.”

    6. Stop the EC2 Instance:

    • a. In the left navigation pane, click on “Instances.”
    • b. Select your EC2 instance.
    • c. Click “Instance State” > “Stop Instance.”
    • d. Wait for the instance to be “stopped.”

    7. Detach the Current Volume:

    • a. On the EC2 Dashboard, in the left pane, click on “Instances.”
    • b. Select the desired EC2 instance.
    • c. Below the instances list, click on the “Description” tab. Scroll to the “Root device” entry and click on the link next to it. Note the volume ID.
    • d. Navigate to “Volumes” in the left pane. Using the noted volume ID, locate and select the current volume.
    • e. Click “Actions” > “Detach Volume.”

    8. Attach the New Volume to the EC2 Instance:

    • a. In the “Volumes” section, find the new volume made from the snapshot.
    • b. Click “Actions” > “Attach Volume.”
    • c. Select your EC2 instance and input the original root device name (e.g., /dev/xvda).
    • d. Click “Attach.”

    9. Start the EC2 Instance:

    • a. Navigate back to “Instances.”
    • b. Select your EC2 instance.
    • c. Click “Instance State” > “Start Instance.”

    10. Optional Clean-Up:

    • a. Navigate to “Volumes.”
    • b. Select the old volume.
    • c. Click “Actions” > “Delete Volume.”

    Spotfire Server with HTTPS encrypted under Linux

    1. prepare the cert and key:
    /opt/tibco/tss-12.5.0.x86_64/jdk/bin$ sudo ./keytool -genkeypair -keystore keystore.p12 -storetype PKCS12 -storepass [yourPassword] -alias [yourHostName] -keyalg RSA -ext SAN=IP:[yourIPaddress] -validity 3650

    or

    /opt/tibco/tss-12.5.0.x86_64/jdk/bin$ sudo ./keytool -genkeypair -keystore keystore.p12 -storetype PKCS12 -storepass [yourPassword] -alias [yourHostName] -keyalg RSA -ext SAN=DNS:[FQDN] -validity 3650

    What is your first and last name? Answer the 1st question.

    /opt/tibco/tss-12.5.0.x86_64/jdk/bin$ sudo ./keytool -export -alias [yourHostName] -storepass [yourPassword] -file server.cer -keystore keystore.p12
    /opt/tibco/tss-12.5.0.x86_64/jdk/bin$ sudo ./keytool -import -v -trustcacerts -alias [yourHostName] -file server.cer -keystore cacerts.jks -keypass [yourPassword] -storepass [yourPassword]

    2. move the certs to /opt/tibco/tss-12.5.0.x86_64/tomcat/certs

    3. edit the information in /opt/tibco/tss-12.5.0.x86_64/tomcat/conf/server.xml

    comment out the http block and recover https block, edit below:

    truststoreFile="./certs/cacerts.jks"
                         truststorePassword="[yourPassword]"
                         truststoreType="jks"
    
    <Certificate certificateKeystoreFile="./certs/keystore.p12"
                         certificateKeystorePassword="[yourPassword]"
                         certificateKeystoreType="PKCS12"
                         certificateKeyAlias="[yourHostName]" />
    

    sometimes it needs to delete certificateKeyAlias="[yourHostName]"

    4. change public address setting in uiconfig.

    5. restart Spotfire server

    How to change domain information in Spotfire Server inside Oracle DB

    As from config list-nodes -t pw, we can see the old information remained.
    Inside Oracle DB, change the content below:

    -- 从所有的表中选取所有记录
    select * from tab;
    
    -- 从tab表中选取tname字段的所有记录
    select tname from tab;
    
    -- 从tab表中选取tname字段的所有记录,但只返回字段值包含'SERVER'的记录
    select tname from tab where tname like ‘%SERVER%’;
    
    -- 描述(获取)node_SERVER_INFO表的结构信息,例如列名,数据类型等
    describe node_SERVER_INFO;
    
    -- 从node_server_info表中选取node_id和servername字段的所有记录
    select node_id,servername from node_server_info;
    
    -- 描述(获取)user_tab_columns表的结构信息
    describe user_tab_columns;
    
    -- 从user_tab_columns表中选取table_name字段的所有记录,但只返回字段值为’SERVERNAME’的记录
    select table_name from user_tab_columns where column_name=’SERVERNAME’;
    
    -- 描述(获取)RESOURCE_POOLS_SERVICES_VIEW表的结构信息
    describe RESOURCE_POOLS_SERVICES_VIEW;
    
    -- 描述(获取)NODE_SERVER_INFO表的结构信息
    describe NODE_SERVER_INFO;
    
    -- 从RESOURCE_POOLS_SERVICES_VIEW表中选取NODE_ID,SERVICE_TYPE,SERVERNAME字段的所有记录
    select NODE_ID,SERVICE_TYPE,SERVERNAME from RESOURCE_POOLS_SERVICES_VIEW;
    
    -- 更新node_server_info表,将servername字段值为’XXX.old.co.jp’的记录的servername字段的值改为’XXX.new.co.jp’
    update node_server_info SET servername=’XXX.new.co.jp’ WHERE servername=’XXX.old.co.jp’;
    
    -- 提交前面的更新操作,使其生效
    commit;
    

    exclude content in db, you need to change the content inside the filese below:

    1. C:\tibco\tss\11.4.7\nm\config\nodemanager.properties

    2. C:\tibco\tsnm\11.4.7\nm\config \config.json

    3. Server alias in uiconfig

    Install anydesk on Ubuntu 23.04

    install prerequisite:

    sudo apt update -y && sudo apt upgrade -y
    
    wget http://ftp.us.debian.org/debian/pool/main/p/pangox-compat/libpangox-1.0-0_0.0.2-5.1_amd64.deb
    
    sudo apt install ./libpangox-1.0-0_0.0.2-5.1_amd64.deb

    then install anydesk:

    sudo apt update -y && sudo apt upgrade -y
    
    wget -qO - https://keys.anydesk.com/repos/DEB-GPG-KEY | sudo apt-key add -
    
    echo "deb http://deb.anydesk.com/ all main" | sudo tee /etc/apt/sources.list.d/anydesk-stable.list
    
    sudo apt update -y && sudo apt upgrade -y
    
    sudo apt install anydesk -y
    
    sudo vi /etc/gdm3/custom.conf 
    
    WaylandEnable=false
    AutomaticLoginEnable = true
    AutomaticLogin = $USERNAME
    
    sudo reboot
    anydesk

    Install Python on Ubuntu 22.04

    Rather than Default Python 3.10.6, install another Python version:

    1. install prerequisite

    sudo apt update -y
    sudo apt upgrade -y
    sudo apt install -y build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libsqlite3-dev libreadline-dev libffi-dev curl libbz2-dev -y

    2. prepare installer

    cd ~/Downloads
    curl -O https://www.python.org/ftp/python/3.8.9/Python-3.8.9.tar.xz
    tar -xf Python-3.8.9.tar.xz
    cd Python-3.8.9

    3. configure the python build

    ./configure --enable-optimizations

    4. compile and install python

    sudo make -j $(nproc)
    sudo make altinstall

    5. If it is successful, you can check the version

    python3.8 --version

    6.Set the newly installed Python version

    sudo update-alternatives --install /usr/bin/python3.8.9 python3.8.9 /usr/local/bin/python3.8 1

    7. update pip

    python3.8.9 -m ensurepip --default-pip
    python3.8.9 -m pip install --upgrade pip

    8. If you want to remove it

    sudo rm /usr/local/bin/python3.8
    sudo rm /usr/local/bin/pip3.8
    sudo rm -rf /usr/local/lib/python3.8
    sudo update-alternatives --remove python /usr/local/bin/python3.8

    Initialize Oracle 21 Configure for Spotfire

    make tnsnames.ora:

    ORCLPDB =
      (DESCRIPTION =
        (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
        (CONNECT_DATA =
          (SERVER = DEDICATED)
          (SERVICE_NAME = orclpdb)
        )
      )
    

    make listener.ora:

    LISTENER =
      (DESCRIPTION_LIST =
        (DESCRIPTION =
          (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
        )
      )
    
    ADR_BASE_LISTENER = C:\app\oracle
    

    Then restart Listener:

    lsnrctl stop
    lsnrctl start

    Then change the state of the pluggable databases:

    sqlplus / as sysdba
    
    /* check the sate: */ 
    SQL> select con_id,name,open_mode from v$pdbs;
    
    /* opens the pluggable database named ORCLPDB */ 
    SQL> alter pluggable database ORCLPDB open;
    /* sets the current session's container context to the ORCLPDB pluggable database */ 
    SQL> alter session set container=ORCLPDB;
    SQL> commit;
    
    /* check the connected container: */ 
    SQL> show con_name;
    
    /* check the pdb name: */ 
    SQL> select pdb_name from cdb_pdbs;
    
    /* connect to the pdb: */ 
    SQL> alter session set container = ORCLPDB;
    
    /* to keep it starts with the windows server startup, you need to save the PDB’s state: */ 
    SQL> alter pluggable database orclpdb save state;
    

    edit the create_databases.bat, eg:

    set SPOTFIREDB_ROOTFOLDER=C:\app\oracle\oradata\ORCL\orclpdb
    set DBSERVER_CONNECTIDENTIFIER=//[yourDBIP]/ORCLPDB
    通过 WordPress.com 设计一个这样的站点
    从这里开始