Te reja dhe Aktivitete

How to Install Webmin on CentOS 8

Webmin is a free, open-source and web-based system configuration and management tool for Unix-like operating systems. You can set up Apache web server, Samba, DNS, Mail, FTP, Database, File system and package management with Webmin web-based interface. Webmin is very similar to cPanel and provides an easy way to manage Linux systems through a web browser.

Prerequisites

  • A server running CentOS 8.
  • A root password is configured on your server.

Getting Started

By default, SELinux is enabled in CentOS 8 server. So you will need to disable it first.

You can do this by editing /etc/selinux/config file:

nano /etc/selinux/config

Make the following changes:

SELINUX=disabled

Save and close the file. Then, restart your server to apply the changes.

Install Webmin with RPM

First, you will need to install the required dependencies by running the following command:

dnf install perl perl-Net-SSLeay openssl perl-Encode-Detect

Once all the dependencies are installed, download the Webmin RPM package from the Sourceforge download page with the following command:

wget https://prdownloads.sourceforge.net/webadmin/webmin-1.930-1.noarch.rpm

Once downloaded, run the following command to install Webmin:

rpm -ivh webmin-1.930-1.noarch.rpm

You should see the following output:

warning: webmin-1.930-1.noarch.rpm: Header V4 DSA/SHA1 Signature, key ID 11f63c51: NOKEY
Verifying...                          ################################# [100%]
Preparing...                          ################################# [100%]
Operating system is CentOS Linux
Updating / installing...
   1:webmin-1.930-1                   ################################# [100%]

Webmin install complete. You can now login to https://centos8:10000/
as root with your root password.

By default, Webmin runs on port 10000. You can check whether Webmin is running or not with the following command:

netstat -ant | grep 10000

You should see the following output:

tcp        0      0 0.0.0.0:10000           0.0.0.0:*               LISTEN  

You can also check the Webmin process with the following command:

ps -ef | grep webmin

You should see the following output:

root      2131     1  0 12:29 ?        00:00:00 /usr/bin/perl /usr/libexec/webmin/miniserv.pl /etc/webmin/miniserv.conf
root      2225  6290  0 12:30 pts/0    00:00:00 grep --color=auto webmin

Install Webmin with Yum Repository

You can also install the Webmin from CentOS Yum repository. First, create a Webmin repository with the following command:

nano /etc/yum.repos.d/webmin.repo

Add the following lines:

[Webmin]
name=Webmin Distribution Neutral
mirrorlist=https://download.webmin.com/download/yum/mirrorlist
enabled=1

Save and close the file. Then, download and add the repository signing key with the following command:

wget http://www.webmin.com/jcameron-key.asc
 rpm --import jcameron-key.asc

Next, install the Webmin by running the following command:

dnf install webmin

Once the installation is completed, you should see the following output:

Installing       : webmin-1.930-1.noarch                                                       2/2 
Running scriptlet: webmin-1.930-1.noarch                                                       2/2 
Webmin install complete. You can now login to https://centos8:10000/
as root with your root password.

Access Webmin in Browser

By default, Webmin listens on port 10000. So you will need to open the Webmin port in firewalld. You can do it with the following command:

firewall-cmd --zone=public --add-port=10000/tcp --permanent
 firewall-cmd --reload

Now, open your web browser and type the URL https://your-server-ip:10000. You will be redirected to the following page:

Provide your root user, password and click on the Sign in button. You should see the Webmin dashboard in the following page:

From here, you can configure and manage your CentOS 8 server easily.Advertisements

Conclusion

Congratulations! you have successfully installed Webmin on CentOS 8 server. You can now easily install LAMP/LEMP server, FTP server and hosting your website easily through the Webmin web interface.

How to connect Codeigniter with MSSQL (SQL Server)

$active_group = ‘my_mssql’;
$active_record = TRUE;

$db[‘my_mssql’][‘hostname’] = ‘Driver={SQL Server Native Client 11.0};Server=Host\Instance;Database=queue_sys;’;
$db[‘my_mssql’][‘username’] = ‘wow_queue’;
$db[‘my_mssql’][‘password’] = ‘wow12345’;
$db[‘my_mssql’][‘database’] = ”;
$db[‘my_mssql’][‘dbdriver’] = ‘odbc’;
$db[‘my_mssql’][‘dbprefix’] = ”;
$db[‘my_mssql’][‘pconnect’] = FALSE;
$db[‘my_mssql’][‘db_debug’] = TRUE;
$db[‘my_mssql’][‘cache_on’] = FALSE;
$db[‘my_mssql’][‘cachedir’] = ”;
$db[‘my_mssql’][‘char_set’] = ‘utf8’;
$db[‘my_mssql’][‘dbcollat’] = ‘utf8_general_ci’;
$db[‘my_mssql’][‘swap_pre’] = ”;
$db[‘my_mssql’][‘autoinit’] = TRUE;
$db[‘my_mssql’][‘stricton’] = FALSE;

Note:
SQL Server Native Client 11.0 or SQL Server Native Client 10.0, just play with both settings.
Server=xx.xx.xx.x usually is in the format Server=Host\Instance

 

A Simple Template for Post Formats



>
’;
echo the_title();
echo ‘

’;
echo the_content();
}
elseif ( has_post_format( ‘gallery’ )) {
echo ‘

’;
echo the_title();
echo ‘

’;
echo the_content();
}

elseif ( has_post_format( ‘image’ )) {
echo ‘

’; echo the_title(); echo ‘

’; echo the_post_thumbnail(‘image-format’); echo the_content();}
elseif ( has_post_format( ‘link’ )) {
echo ‘

’; echo the_title(); echo ‘

’; echo the_content();}
elseif ( has_post_format( ‘quote’ )) {
echo the_content();}
elseif ( has_post_format( ‘status’ )) {
echo the_content();}
elseif ( has_post_format( ‘video’ )) {
echo ‘

’; echo the_title(); echo ‘

’; echo the_content();}
elseif ( has_post_format( ‘audio’ )) {
echo ‘

’; echo the_title(); echo ‘

’; echo the_content();}
else {
echo ‘

’; echo the_title(); echo ‘

’; echo the_content();}
?>




.htaccess File

# invoke rewrite engine
RewriteEngine On
RewriteBase /

Options -Indexes

Options -MultiViews

# Redirect to www
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

# Prevent scraping from archive for free demo
RewriteCond %{HTTP_USER_AGENT} (ia_archiver) [NC]
RewriteRule . – [F,L]

# redirect all extension to html
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^(.*)\.shtml$ $1.html [L,NC,R=301]
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^(.*)\.phtml$ $1.html [L,NC,R=301]
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^(.*)\.htm$ $1.html [L,NC,R=301]
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^(.*)\.php$ $1.html [L,NC,R=301]
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^(.*)\.aspx$ $1.html [L,NC,R=301]
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^(.*)\.asp$ $1.html [L,NC,R=301]
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^(.*)\.jsp$ $1.html [L,NC,R=301]

# Add a trailing slash (/) to a URL
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !\.[A-Za-z0-9]*$
RewriteRule .*[^/]$ %{REQUEST_URI}/ [L,R=301]

# Create pretty URLs
RewriteRule ^([^/]+)/$ $1.html
RewriteRule ^([^/]+)/([^/]+)/$ $1/$2.html
RewriteRule ^([^/]+)/([^/]+)/([^/]+)/$ $1/$2/$3.html
RewriteRule ^([^/]+)/([^/]+)/([^/]+)/([^/]+)/$ $1/$2/$3/$4.html
RewriteRule ^([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/$ $1/$2/$3/$4/$5.html
RewriteRule ^([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/$ $1/$2/$3/$4/$5/$6.html
RewriteRule ^([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/$ $1/$2/$3/$4/$5/$6/$7.html

RewriteRule ^index.html$ / [L,R=301]

How to use PHP to connect to SQL Server

php
$myServer = "10.85.80.229";
$myUser = "root";
$myPass = "pass";
$myDB = "testdb";

$dbhandle = mssql_connect($myServer, $myUser, $myPass)
  or die("Couldn't connect to SQL Server on $myServer"); 
?>

 

php  
$serverName = "ServerName"; 
$uid = "sqlusername";   
$pwd = "sqlpassword";  
$databaseName = "DBName"; 

$connectionInfo = array( "UID"=>$uid,                            
                         "PWD"=>$pwd,                            
                         "Database"=>$databaseName); 

/* Connect using SQL Server Authentication. */  
$conn = sqlsrv_connect( $serverName, $connectionInfo);  

$tsql = "SELECT id, FirstName, LastName, Email FROM tblContact";  

/* Execute the query. */  

$stmt = sqlsrv_query( $conn, $tsql);  

if ( $stmt )  
{  
     echo "Statement executed.
\n";  
}   
else   
{  
     echo "Error in statement execution.\n";  
     die( print_r( sqlsrv_errors(), true));  
}  

/* Iterate through the result set printing a row of data upon each iteration.*/  

while( $row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_NUMERIC))  
{  
     echo "Col1: ".$row[0]."\n";  
     echo "Col2: ".$row[1]."\n";  
     echo "Col3: ".$row[2]."
\n";  
     echo "-----------------
\n";  
}  

/* Free statement and connection resources. */  
sqlsrv_free_stmt( $stmt);  
sqlsrv_close( $conn);  
?>  

How to Activate Windows 10 Pro with CMD

Step 1. Click Start and type cmd, right-click Command Prompt app and choose Run as administrator.

Step 2. Copy and paste the following command line in Command Prompt window and hit Enter. If you find other keys for Windows 10 Pro, you can replace it with the key in the command line after slmgr /ipk.

slmgr /ipk W269N-WFGWX-YVC9B-4J6C9-T83GX

Step 3. Type the following command lines and remember to hit Enter after you type each line.

slmgr /skms kms.xspace.in

slmgr /ato

How to Check If Your Windows 10 Is Activated or Not

If you want to check whether your Windows 10 computer is activated or not, you can press Windows + R keys on the keyboard to open Run box, type slmgr.vbs -xpr in Run box and hit Enter.

How to Permanently Activate Windows 10 with CMD

Without third-party Windows 10 activation tools, you can activate Windows 10 with CMD for free. Here we’ll introduce how to activate Windows Enterprise edition with CMD.

Step 1. You can press Windows + R key on the keyboard to open Windows Run box. Type cmd, and press Ctrl + Shift + Enter to open and run Windows Command Prompt as administrator.

Step 2. After you enter into Windows 10 Command Prompt, you can copy and paste this command line: slmgr.vbs /upk, in the Command Prompt window. Hit Enter to execute the command.

Step 3. Next you can copy and paste this command line and hit Enter to install the Windows 10 product key: slmgr /ipk NPPR9-FWDCX-D2C8J-H872K-2YT43.

Step 4. Then you can type slmgr /skms zh.us.to command line and hit Enter.

Step 5. At last, copy and paste slmgr /ato and hit Enter to activate Windows 10 for free with CMD.

Hide all WordPress update notifications in dashboard

WordPress has a build-in upgrade system. This system automatically informs you when there is an upgrade available for WordPress, or one of the themes or plugins that are installed on your WordPress installation.

To disable this update notification, there is no switch in the settings menu or anywhere else in the admin dashboard. To prevent WordPress from showing these information snippets on top of your WordPress dashboard, you shall need to add a PHP code snippet to your functions.php file.

So head over to your theme’s folder (/wp-content/themes/your-theme) and open the functions.php file.

Now past the following code at the bottom of that file:

Disable WordPress update notification
1
2
3
4
5
6
7
// hide update notifications
function remove_core_updates(){
global $wp_version;return(object) array('last_checked'=> time(),'version_checked'=> $wp_version,);
}
add_filter('pre_site_transient_update_core','remove_core_updates'); //hide updates for WordPress itself
add_filter('pre_site_transient_update_plugins','remove_core_updates'); //hide updates for all plugins
add_filter('pre_site_transient_update_themes','remove_core_updates'); //hide updates for all themes

Remove any of the last three lines if you only want to hide core updates, themes updates or plugin updates.

Save your file and the update notification in your WordPress admin area should be gone. If you work with clients, this may be an elegant solution for you to keep the interface of your client’s dashboard as simple as possible.

Free Web Hosting