Skip to main content

Command Line

Configure Sendmail with Sendgrid for SmartHost Mail Relay

Submitted by system on
Set the authorization credentials in /etc/mail/access AuthInfo:smtp.sendgrid.net "U:apikey" "P:" "M:PLAIN"
Define the Smart Host in /etc/mail/sendmail.mc. You should add these lines just after the commented
\#dnl define('SMART_HOST', 'smtp.your.provider')dnl
line in the file. In Ubuntu these would be the last lines added to the file. define(`SMART_HOST', `smtp.sendgrid.net')dnl
FEATURE(`access_db')dnl
define(`RELAY_MAILER_ARGS', `TCP $h 587')dnl
define(`ESMTP_MAILER_ARGS', `TCP $h 587')dnl

Upgrading from Drupal 7 to Drupal 10

Submitted by system on
Create a new D10 portal. Enable migrate modules. Enable https://www.drupal.org/project/migrate_upgrade to allow migrations via Drush. Set up a Migrate Database $databases['migrate']['default'] = [
'database' => 'drupal7db',
'username' => 'drupal7db',
'password' => 'drupal7db',
'prefix' => '',
'host' => 'localhost',
'port' => '',
'driver' => 'mysql',
'namespace' => 'Drupal\\mysql\\Driver\\Database\\mysql',
'autoload' => 'core/modules/mysql/src/Driver/Database/mysql/',
];

Useful DB Queries for Drupal Applications

Submitted by system on
Show grouped node counts based on OG group ids for nodes created after a particular time stamp select gid, count(*) from og_membership inner join node on og_membership.etid = node.nid and node.created >= 1678127400 group by gid;
Show node type specific node count list select type,count(*) from node group by type;
Show group membership wise node counts select gid,count(*) from og_membership group by gid;
Start the node next Increment number from a specific nid ALTER TABLE node AUTO_INCREMENT = 20000000;

Perform Penetrative testing in Ubuntu

Submitted by system on
Penetrative testing in Ubuntu can be done using the oscap tool. Download the latest vulnerability list using the command wget https://security-metadata.canonical.com/oval/com.ubuntu.$(lsb_release -cs).usn.oval.xml.bz2
Evaluate the vulnerability using the oscap command oscap oval eval --report report.html com.ubuntu.$(lsb_release -cs).usn.oval.xml
-- Link: https://ubuntu.com/security/oval

Upgrade MySQL 5.7 to MySQL 8

Submitted by system on
To upgrade in Ubuntu 18.04 server. Step I: Get the upgrade command shell and check upgrade issues Get the MySQL Shell download link here: https://dev.mysql.com/downloads/shell/ This shell will assist in finding issues with the current installation. Install the MySQL upgrade shell with the command dpkg -i mysql-shell_8.0.30-1ubuntu18.04_amd64.deb
This will make available the mysqlsh command. Execute this mysqlsh command with root user to access the MySQL JS shell. mysqlsh

Handling Issues in Migration

Submitted by system on
Fix "non-existent config entity name returned by FieldStorageConfigInterface::getBundles()" Normally it will show that a field belongs to a non existing bundle for a node, comment etcetra in log post migration. Solving a field that does not belong to non existent bundle in a node, example, field_agenda present in a non existent bundle makemeeting of node type $key_value_factory = \Drupal::service("keyvalue");
$field_map_kv_store = $key_value_factory->get("entity.definitions.bundle_field_map");
$node_map = $field_map_kv_store->get("node");

Optimizing Images using command line

Submitted by system on
The images uploaded by users may not be of ideal size and may require compression to manage server space. There are some tools available for compressing JPG and PNG files. Please note that the owner changes to the current username for the file after compression. Please remember to change ownership if required of the file or per folder post compression. jpegoptim : Optimize a jpg image with the same name jpegoptim image.jpg
Optimize all jpg images in a folder jpegoptim *.jpg

SSL Certificate Using Let's Encrypt for Ubuntu

Submitted by system on
Automated creation, renewing of certificates is provided by software called certbot. To view a list of the certificates Certbot knows about, run the certificates subcommand: $> certbot certificates
Deleting certificates $> certbot delete --cert-name example.com
Install Certificates Using Apache $> sudo certbot --apache -d example.in -d www.example.in