Install Ollama and DeepSeek On Ubuntu 22.04

Ref: https://ollama.com/download

Select the linux then Install on your terminal with this command:
curl -fsSL https://ollama.com/install.sh | sh

[codesyntax lang=”bash”]

[/codesyntax]

on the search model text box, select ‘deepseek-r1’ or go to https://ollama.com/library/deepseek-r1
Okay. I just choose ‘1.5b’ model as a test. then install it on your terminal with this command:
ollama run deepseek-r1:1.5b

[codesyntax lang=”bash”]

[/codesyntax]

Integrate it with VSCode:
Watch : https://www.youtube.com/watch?v=cqFRE9c8048&ab_channel=ChaooCharles

the problem:
1. it’ll take your disk space. For just 1.5b model, it’ll take 1.1 GB disk space
2. If you don’t have GPU, it’ll use your CPU resource and it took 100% CPU resources on my Ubuntu machine
You can stop and disable the ollama services on your machine
[codesyntax lang=”bash”]

[/codesyntax]

Create a Login App with ASP.NET on Ubuntu 22.04

Here’s a step-by-step guide to create a simple login form using ASP.NET Core (C#) and MS SQL Server with VS Code and Linux:

  1. Install .NET SDK If you haven’t already, install the .NET SDK for your Linux distribution. You can find instructions on the official Microsoft website.check your dotnet version
    [codesyntax lang=”bash”]

    [/codesyntax]
  2. Create a new ASP.NET Core project Open a terminal and run:

    [codesyntax lang=”bash”]

    [/codesyntax]

    Go to the project directory ‘LoginApp’ with ‘cd LoginApp’

  3. Install required NuGet packages Run the following commands:
    [codesyntax lang=”bash”]

    [/codesyntax]

    Make sure the version is match in LoginApp.csproj
    [codesyntax lang=”csharp”]

    [/codesyntax]

  4. Set up the database connection Open appsettings.json and add the connection string:
    [codesyntax lang=”text”]

    [/codesyntax]
    Note: I need to add ‘TrustServerCertificate=True;’

  5. Create ApplicationDbContext Create a new file ApplicationDbContext.cs
    [codesyntax lang=”csharp”]

    [/codesyntax]

  6. Update Program.cs Replace the content of Program.cs:
    [codesyntax lang=”csharp”]

    [/codesyntax]

  7. Create Login Model Create Models/LoginModel.cs:
    [codesyntax lang=”csharp”]

    [/codesyntax]

  8. Create Account Controller Create Controllers/AccountController.cs:
    [codesyntax lang=”csharp”]

    [/codesyntax]

  9. Create Login View Create Views/Account/Login.cshtml:
    [codesyntax lang=”html4strict”]

    [/codesyntax]

  10. Set up the database. Create a new database ‘LoginApp’
  11. Add a test user Create DbInitializer.cs:
    [codesyntax lang=”csharp”]

    [/codesyntax]
    Note: it’ll create a new dummy user with
    email: admin@example.com
    password: Admin123!

  12. Run the application Execute:

  13. Navigate to http://localhost:5000/Account/Login in your browser.
  14. create some navigation menus (login, logout, etc) on the homepage
    Create a new file called _NavBar.cshtml in the Views/Shared folder with the following content:
    [codesyntax lang=”html4strict”]

    [/codesyntax]

    Now, let’s include this partial view in your layout file. Open the Views/Shared/_Layout.cshtml file and add the following line just after the opening <body> tag:
    [codesyntax lang=”html4strict”]

    [/codesyntax]
    Note: I need to remove the default <header> tag to use the new partial navbar

  15. create controller for account logout
    modify Controllers/AccountController.cs
    [codesyntax lang=”csharp”]

    [/codesyntax]

    Now, let’s update the _NavBar.cshtml partial view to use a form for the logout action, as it should be a POST request. Update the logout link in the _NavBar.cshtml file like this:
    [codesyntax lang=”html4strict”]


    [/codesyntax]
    at the end of this file, add this javascript
    [codesyntax lang=”html4strict”]

    [/codesyntax]
  16. Add controller for registration and forgot password?

Install Microsoft SQL Server 2022 On Ubuntu 22.04

Ref: https://learn.microsoft.com/en-us/sql/linux/quickstart-install-connect-ubuntu?view=sql-server-ver16&tabs=ubuntu2204

1. Update and upgrade the packages on ubuntu 22.04
[codesyntax lang=”bash”]

[/codesyntax]

2. Download the public key, convert from ASCII to GPG format, and write it to the required location:
[codesyntax lang=”bash”]

[/codesyntax]

3. Manually download and register the SQL Server Ubuntu repository:
[codesyntax lang=”bash”]

[/codesyntax]

4. Run the following commands to install SQL Server:
[codesyntax lang=”bash”]

[/codesyntax]

5. After the package installation finishes, run mssql-conf setup and follow the prompts to set the sa password and choose your edition.
Just choose ‘Developer’ version. type 2. My local sa password is {my-nick-name-first-uppercase}@123
[codesyntax lang=”bash”]

[/codesyntax]

6. Once the configuration is done, verify that the service is running:
[codesyntax lang=”bash”]

[/codesyntax]

Install the SQL Server command-line tools (sqlcmd)

1. Import the public repository GPG keys.
[codesyntax lang=”bash”]

[/codesyntax]

2. Register the Microsoft Ubuntu repository. For Ubuntu 22.04, use the following command:
[codesyntax lang=”bash”]

[/codesyntax]

3. Update the sources list and run the installation command with the unixODBC developer package.
[codesyntax lang=”bash”]

[/codesyntax]

To update to the latest version of mssql-tools, run the following commands:
[codesyntax lang=”bash”]

[/codesyntax]

4. Add /opt/mssql-tools18/bin/ to your PATH environment variable in a bash shell.

To make sqlcmd and bcp accessible from the bash shell for login sessions, modify your PATH in the ~/.bash_profile file with the following command:
[codesyntax lang=”bash”]

[/codesyntax]

5. Test sqlcmd with ‘sqlcmd -?’
[codesyntax lang=”bash”]

[/codesyntax]

Connect locally. I tried to use : sqlcmd -S localhost -U sa -P your_password
but it showed up this error
[codesyntax lang=”bash”]

[/codesyntax]

it turned out I need to add -C parameter at the end like this
[codesyntax lang=”bash”]

[/codesyntax]

Create a new database

For example create a new database TestDB from sqlcmd
[codesyntax lang=”bash”]

[/codesyntax]

Create a new table dbo.Inventory and Insert data
[codesyntax lang=”bash”]

[/codesyntax]

Install DBeaver (https://dbeaver.io/)
This is Database GUI for many databases including MS SQL Server

Download it https://dbeaver.io/download/
I used Ubuntu PPA
[codesyntax lang=”bash”]

[/codesyntax]

Open DBeaver CE and select to the MS SQL Server

Connect to the MS SQL Server but it needs to use JDBC driver. Install it directly from the DBeaver

If everything is okay, it’ll look like this

on the DBeaver GUI you can add a new row. for example add a new row
ID: 3
Name: Apple
Quantity: 158
Then save

on the sqlcmd should reflect the changes
[codesyntax lang=”bash”]

[/codesyntax]

Create a Self-Signed SSL Certificate for Apache in Ubuntu 22.04

Ref: https://www.digitalocean.com/community/tutorials/how-to-create-a-self-signed-ssl-certificate-for-apache-in-ubuntu-22-04

1. open up the firewall ufw for the http and https ports:
[codesyntax lang=”bash”]

[/codesyntax]

2. enable mod_ssl
[codesyntax lang=”bash”]

[/codesyntax]

3. Creating the TLS Certificate
[codesyntax lang=”bash”]

[/codesyntax]

4. Configuring Apache to Use TLS
[codesyntax lang=”bash”]

[/codesyntax]

the config file like this
[codesyntax lang=”php”]

[/codesyntax]
don’t forget to reload/restart apache2 service

5. Now load your site in a browser, being sure to use https:// at the beginning.

You should see an error. This is normal for a self-signed certificate! The browser is warning you that it can’t verify the identity of the server, because our certificate is not signed by any of its known certificate authorities. For testing purposes and personal use this can be fine. You should be able to click through to advanced or more information and choose to proceed.

Install xdebug with PHP 8.2 on Ubuntu 22.04

<OLD>Ref: https://gist.github.com/henryonsoftware/066d8282daaf8c2ae281ce010e3e5404

1. Download xdebug source code from https://github.com/xdebug/xdebug/releases
for example the xdebug 3.3.2 from https://github.com/xdebug/xdebug/archive/refs/tags/3.3.2.tar.gz

2. extract the downloaded file
satria@teddy:~$ cd Downloads/
satria@teddy:~/Downloads$ tar -xvzf xdebug-3.3.2.tar.gz

3. run ‘phpize’
satria@teddy:~/Downloads$ cd xdebug-3.3.2/
satria@teddy:~/Downloads/xdebug-3.3.2$ phpize
Configuring for:
PHP Api Version: 20210902
Zend Module Api No: 20210902
Zend Extension Api No: 420210902
configure.ac:165: warning: The macro `AC_PROG_LIBTOOL’ is obsolete.
configure.ac:165: You should run autoupdate.
build/libtool.m4:99: AC_PROG_LIBTOOL is expanded from…
configure.ac:165: the top level

4. run ‘./configure’
satria@teddy:~/Downloads/xdebug-3.3.2$ ./configure

5. run ‘make’
satria@teddy:~/Downloads/xdebug-3.3.2$ make

6. copy the module xdebug.so to php lib 20210902
</OLD>
<NEW>

Use php from repository ppa:ondrej/php
then install php8.2-dev
[codesyntax lang=”php”]

[/codesyntax]

then install php8.2-xdebug
[codesyntax lang=”php”]

[/codesyntax]

check the php version
[codesyntax lang=”php”]

[/codesyntax]

if not php8.2, you can select it by using
[codesyntax lang=”php”]

[/codesyntax]

CONFIG XDEBUG

SETTING

 

Install Flutter and Android Studio on Ubuntu 22.04

Ref: https://docs.flutter.dev/get-started/install/linux/android

Development tools

To develop Flutter on Linux:

1. Verify that you have the following tools installed: bash, file, mkdir, rm, which

2. Install the following packages: curl, git, unzip, xz-utils, zip, libglu1-mesa

3. To develop Android apps:
a. Install the following prerequisite packages for Android Studio.

b. Install Android Studio 2023.3.1 (Jellyfish) or later to debug and compile Java or Kotlin code for Android. Flutter requires the full version of Android Studio.
download and install the latest android studio from https://developer.android.com/studio

If you are running a 64-bit version of Ubuntu, you need to install some 32-bit libraries with the following command:

read the installation note on https://developer.android.com/studio/install#linux

Extract the downloaded file:

Move to the android-studio directory:

Run Android Studio:
Navigate to the bin directory and run the installer:

Use VS Code to install Flutter

To install Flutter using these instructions, verify that you have installed Visual Studio Code 1.77 or later and the Flutter extension for VS Code.

Prompt VS Code to install Flutter
#
Launch VS Code.
To open the Command Palette, press Control + Shift + P.
In the Command Palette, type flutter.
Select Flutter: New Project.
VS Code prompts you to locate the Flutter SDK on your computer.

 

If you have the Flutter SDK installed, click Locate SDK.
If you do not have the Flutter SDK installed, click Download SDK.

This option sends you the Flutter install page if you have not installed Git as directed in the development tools prerequisites.
When prompted Which Flutter template?, ignore it. Press Esc. You can create a test project after checking your development setup.

INSTALL CMAKE (ALSO FOR LINUX APP)
sudo apt install cmake

Launching lib/main.dart on Linux in debug mode…

CMake Error: CMake was unable to find a build program corresponding to “Ninja”. CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool.

CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage

Error: Unable to generate build files

INSTALL NINJA BUILD
sudo apt install ninja-build

Launching lib/main.dart on Linux in debug mode…

CMake Error at /usr/share/cmake-3.22/Modules/CMakeDetermineCXXCompiler.cmake:48 (message):

Could not find compiler set in environment variable CXX:

clang++.

Call Stack (most recent call first):

CMakeLists.txt:3 (project)

2

CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage

Error: Unable to generate build files

ALSO
satria@teddy:/opt/android-studio/bin$ sudo apt-get install \
clang cmake git \
ninja-build pkg-config \
libgtk-3-dev liblzma-dev \
libstdc++-12-dev
BUT GOT

libbrotli-dev : Depends: libbrotli1 (= 1.0.9-2build6)
SOLUTION:

THEN RE-RUN:
satria@teddy:/opt/android-studio/bin$ sudo apt-get install \
clang cmake git \
ninja-build pkg-config \
libgtk-3-dev liblzma-dev \
libstdc++-12-dev

Install Java and Tomcat on Ubuntu 22.04

READ: https://tecadmin.net/how-to-install-tomcat-on-ubuntu-22-04/
ALSO READ: https://myprojects.advchaweb.com/index.php/2021/09/27/install-tomcat-on-ubuntu-20-04/

INSTALL OPENJDK 11

CHECK JAVA VERSION

CREATE A TOMCAT USER

DOWNLOAD TOMCAT 10
AT THE TIME, THE LATEST STABLE VERSION IS 10.1.19. DOWNLOAD THE BINARY (https://dlcdn.apache.org/tomcat/tomcat-10/v10.1.19/bin/apache-tomcat-10.1.19.tar.gz)

EXTRACT IT TO /opt/tomcat DIR

SET THE PERMISSION
First, we’ll change the directory ownership to tomcat.

Next, make all scripts within the bin directory executable.

Create Tomcat Application Accounts
Now, configure your tomcat with user accounts to secure access of admin/manager pages. To do this, edit conf/tomcat-users.xml file in your editor and paste the following code inside <tomcat-users> </tomcat-users> tags. We recommend changing the password in the below configuration with high secured password.

ADD THE ROLES

Allow Remote Hosts to Access Tomcat
The default Tomcat manager and host-manager applications are accessible for localhost only. To allow access to these pages from the remote system, you need to modify the following configuration files.

You can either allow a specific remote system or allow all. Edit the context.xml file for manager and host manager application:

Comment out the section added for IP address restriction to allow connections from anywhere.

Similarly edit context.xml for host manager application in text editor:

Create a Systemd Service File
We’ll now create a systemd service file to manage the Tomcat service. Open a new service file in a text editor:

Paste in the following configuration:

Start and Enable Tomcat
After creating the service file, reload the systemd daemon to read the new file:

Next, start the Tomcat service with:

CHECK Tomcat service status

If everything went well, enable Tomcat to start on boot:

Open the Firewall
You also need to check if the firewall is not blocking the incoming connections to Tomcat’s port (default is 8080). This depends on what firewall you are using:

For UFW (Uncomplicated Firewall) in Ubuntu:

Test the Installation
The default Tomcat server runs on port 8080. As you have configured Tomcat on your system, you can access web interface from your system. You can access tomcat interfaces by entering your server’s IP address or a domain name pointed to that server, followed by port 8080 in your browser:

http://localhost:8080/

Tomcat Manager App is a web application packaged with the Tomcat server application. The Manager interface provides us with the basic functionality we need to manage our deployed web applications.

Click the Manager App button home page or directly type /manager in the browser URL of the main Tomcat server to access it.
http://localhost:8080/manager/html
user: admin
pass: Admin@123

TOMCAT LOG
THE DEFAULT LOG FILE IS IN /opt/tomcat/apache-tomcat-10.1.19/logs/ DIR!
THE LOG FILE IS /opt/tomcat/apache-tomcat-10.1.19/logs/catalina.out
To change the default location of the log file, edit the startup.sh file and locate the entry: