SlideShare a Scribd company logo
Linux for Programmers 
Md. Al-Amin opu 
Programmer and *nix user
Essential tools 
gedit 
Sublime Text
Installing gedit 
sudo apt-get install gedit
Installing Sublime Text 
1. sudo add-apt-repository ppa:webupd8team/sublime-text-3 
2. sudo apt-get update 
3. sudo apt-get install sublime-text-installer 
OR 
Download .deb file http://www.sublimetext.com/3
Setting up environment 
cd ~/ 
mkdir programming 
cd programming 
mkdir cprogram 
mkdir cppprogram 
mkdir python 
mkdir php
C/C++ Programming
Installing C/C++ compiler 
C compiler comes with default packages in Ubuntu/Mint 
We need to install C++ compiler for programming in C++ 
sudo apt-get install build-essential 
sudo apt-get install g++
Creating a new file/ c program 
Go to your home folder 
cd ~/ 
Then go to your “cprogram” folder 
cd programming 
cd cprogram 
Create a new file or c program 
nano hello.c 
OR 
gedit hello.c
View the content of file 
cat filename 
cat hello.c
Compile and debug c program 
Compiling without flags 
gcc hello.c -o helloWorld 
Compiling with flags 
gcc -Wall -W -Werror hello.c -o HelloWorld 
Run program 
./HelloWorld
Creating a c++ program 
Go to your home folder 
cd ~/ 
Then go to your “cprogram” folder 
cd programming 
cd cppprogram 
Create a new file or c program 
nano new.cpp 
OR 
gedit new.cpp
Compile and debug c++ program 
Compiling without flags 
g++ new.cpp -o NewWorld 
Compiling with flags 
g++ -Wall -W -Werror new.cpp -o NewWorld 
Run program 
./NewWorld
Python Programming
Python Interpreter 
Python comes with build in package in Ubuntu/Mint 
Check python is installed or not 
python –version 
If not, install python using following command 
sudo apt-get install python 
Run python interpreter using 
python 
Type 
print “Hello World”
Run Python from a separate file 
cd ~/ 
cd programming 
cd python 
Creating a new python program 
nano hello.py 
OR 
gedit hello.py
Things to Remember 
Add this line to indicate python interpreter 
#! /usr/bin/python 
Give proper permission to the file 
chmod a+x hello.py 
u stands for user. 
g stands for group. 
o stands for others. 
a stands for all. x stand for execute 
r stand for read 
w stand for right
More about permission 
# Permission rwx 
7 read, write and execute 111 
6 read and write 110 
5 read and execute 101 
4 read only 100 
3 write and execute 011 
2 write only 010 
1 execute only 001 
0 none 000 
To know more visit: http://en.wikipedia.org/wiki/Chmod
Ah!!! Lets run now 
To run python program 
python hello.py
PHP-MySQL 
Programming
LAMP Stack 
LAMP stands for L=Linux , A = Apache , M=MySQL P=PHP 
Alternative of LAMP is LEMP 
L= Linux , E= nginx (Engine X) , M= MySQL, P=PHP
Setting up Apache Server 
Update software package source 
sudo apt-get update 
Installing apache2 
sudo apt-get install apache2 
Testing Web Server 
http://localhost 
Web Server default folder 
/var/www/html
Install and Configure MySQL 
First we need to install MySQL Server 
sudo apt-get install mysql-server 
Configure MySQL server 
mysql_secure_installation
Creating database and user 
First login to mysql 
mysql -u root -p // root is default user. 
To create a database 
create database lollipop; // 'lolipop' is our database name 
To create user and give permission 
grant all on lollipop.* to 'candy' identified by '5t1ck'; 
// 'candy' is username. '5t1ck' is password 
Update privileges 
flush privileges; 
To know more about MySQL CLI : http://dev.mysql.com/doc/refman/5.6/en/mysql.html
Installing PHP and helper package 
Installing PHP5 
sudo apt-get install php5 
Lib-apache module for php5 
sudo apt-get install libapache2-mod-php5 
To connect mysql with php 
sudo apt-get install php5-mysql 
GD module for php 
sudo apt-get install php5-gd 
PHP CLI 
sudo apt-get install php5-cli
Creating and Running PHP file 
Go to web server folder 
cd /var/www/html 
Create a new file 
nano info.php or gedit info.php 
Inside the file , paste this code 
<?php phpinfo(); ?> 
Run the file from your browser 
http://localhost/info.php
Change apache, PHP, MySQL configuration 
To change apache configuration 
sudo gedit /etc/apach2/apache2.conf 
To change PHP configuration 
sudo gedit /etc/php5/apache2/php.ini 
To change MySQL configuration 
sudo gedit /etc/mysql/my.cnf
Changing Web Server Server Directory 
Edit apache2 config file 
sudo gedit /etc/apach2/apache2.conf 
Change directory to your own directory 
<Directory /home/programming/php/> 
Options Indexes 
FollowSymLinks 
AllowOverride All 
Require all granted 
</Directory> 
<Directory /var/www/> 
Options Indexes 
FollowSymLinks 
AllowOverride All 
Require all granted 
</Directory>
Restarting apache Server 
If we make any change on the server configuration, always 
need to restart the server 
To restart apache server 
sudo service apache2 restart
Installing phpmyadmin 
To install 
sudo apt-get install phpmyadmin 
It should automatically configure the phpmyadmin. Can be 
run through http://localhost/phpmyadmin 
If you need to re-cofigure phpmyadmin run 
sudo dpkg-reconfigure -plow phpmyadmin 
Then edit apache config file and add this line add the end of 
that file. 
Include /etc/phpmyadmin/apache.conf 
Restart web server
Virtual Host
Creating Virtual Host 
Go to apache sites-available directory 
cd /etc/apache2/sites-available/ 
Create a new file 
sudo gedit dev.conf 
Paste this code on the file 
<VirtualHost *:80> 
ServerAdmin webmaster@local.dev 
ServerName local.dev 
ServerAlias www.local.dev 
DocumentRoot /home/programming/php/dev/ 
ErrorLog /home/programming/php/dev/error.log 
</VirtualHost>
Configure Virtual host 
cd ~/ 
cd programming 
cd php 
mkdir dev 
chown -R user:user dev 
chmod 755 -R dev
Enable and Run Virtual host 
To enable virtual host 
sudo a2ensite dev.conf 
Edit host file to assign local IP (Option) 
sudo gedit /etc/hosts 
Restart apache 
sudo service apache2 restart 
To run newly created host 
http://local.dev
Remote Server
Login Via SSH 
ssh user@hostname 
Example : ssh root@23.95.55.245 
To logout use 
exit or logout
Questions???
Thank You

More Related Content

PPT
Apache1.ppt
PDF
Drupal camp South Florida 2011 - Introduction to the Aegir hosting platform
PDF
Set up Hadoop Cluster on Amazon EC2
DOCX
Document Management: Opendocman and LAMP installation on Cent OS
PDF
Lamp Server With Drupal Installation
PPT
Linux apache installation
PDF
Caching the Uncacheable
PPT
Apache1.ppt
Drupal camp South Florida 2011 - Introduction to the Aegir hosting platform
Set up Hadoop Cluster on Amazon EC2
Document Management: Opendocman and LAMP installation on Cent OS
Lamp Server With Drupal Installation
Linux apache installation
Caching the Uncacheable

What's hot (20)

DOCX
Install apache on centos
PPTX
How to Install LAMP in Ubuntu 14.04
PPTX
Installing apache sqoop
PPTX
Ansible Network Automation session1
PPTX
Installing hive on ubuntu 16
PPTX
Installing hadoop on ubuntu 16
PPTX
Dockerizing WordPress
PPTX
Drupal from scratch
PPT
Linux Webserver Installation Command and GUI.ppt
PDF
Red Hat Certified Engineer (RHCE) EX294 Exam Questions
PDF
Aeon mike guide transparent ssl filtering (1)
PDF
Aeon mike guide transparent ssl filtering
PPTX
Compcon 2016 Workshop
PDF
Deploying with Super Cow Powers (Hosting your own APT repository with reprepro)
PPTX
Installing and running Postfix within a docker container from the command line
PPT
Installing softwares in linux
PPT
are available here
DOCX
How to install and configure LEMP stack
PPT
WE18_Performance_Up.ppt
Install apache on centos
How to Install LAMP in Ubuntu 14.04
Installing apache sqoop
Ansible Network Automation session1
Installing hive on ubuntu 16
Installing hadoop on ubuntu 16
Dockerizing WordPress
Drupal from scratch
Linux Webserver Installation Command and GUI.ppt
Red Hat Certified Engineer (RHCE) EX294 Exam Questions
Aeon mike guide transparent ssl filtering (1)
Aeon mike guide transparent ssl filtering
Compcon 2016 Workshop
Deploying with Super Cow Powers (Hosting your own APT repository with reprepro)
Installing and running Postfix within a docker container from the command line
Installing softwares in linux
are available here
How to install and configure LEMP stack
WE18_Performance_Up.ppt
Ad

Similar to Linux for programmers (20)

PPTX
Linux Presentation
PDF
Installing Lamp Stack on Ubuntu Instance
PDF
How to Install phpMyAdmin on Debian 12.pdf
PPT
Its3 Drupal
PPT
Its3 Drupal
PDF
Open erp on ubuntu
PDF
How to install r1 soft
PPTX
PPT
Install and configure linux
PDF
How to Install Apache on Debian 12 Server
PPT
Ansible presentation
PPT
Linux Webserver Installation Command and GUI.ppt
PDF
PHP selber bauen
PDF
Dockerizing Symfony Applications - Symfony Live Berlin 2014
 
PPT
Professional deployment
PPTX
Installaling Puppet Master and Agent
PDF
Ubuntu Practice and Configuration
PDF
Hadoop completereference
PDF
Deploying Symfony | symfony.cat
PPT
Tame Your Build And Deployment Process With Hudson, PHPUnit, and SSH
Linux Presentation
Installing Lamp Stack on Ubuntu Instance
How to Install phpMyAdmin on Debian 12.pdf
Its3 Drupal
Its3 Drupal
Open erp on ubuntu
How to install r1 soft
Install and configure linux
How to Install Apache on Debian 12 Server
Ansible presentation
Linux Webserver Installation Command and GUI.ppt
PHP selber bauen
Dockerizing Symfony Applications - Symfony Live Berlin 2014
 
Professional deployment
Installaling Puppet Master and Agent
Ubuntu Practice and Configuration
Hadoop completereference
Deploying Symfony | symfony.cat
Tame Your Build And Deployment Process With Hudson, PHPUnit, and SSH
Ad

Recently uploaded (20)

PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
PDF
Nekopoi APK 2025 free lastest update
PPTX
Transform Your Business with a Software ERP System
PDF
System and Network Administration Chapter 2
PPTX
ai tools demonstartion for schools and inter college
PDF
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
PDF
Which alternative to Crystal Reports is best for small or large businesses.pdf
PDF
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
PDF
Digital Strategies for Manufacturing Companies
PDF
Wondershare Filmora 15 Crack With Activation Key [2025
PDF
Odoo Companies in India – Driving Business Transformation.pdf
PDF
Softaken Excel to vCard Converter Software.pdf
PPTX
CHAPTER 2 - PM Management and IT Context
PDF
Upgrade and Innovation Strategies for SAP ERP Customers
PPTX
Essential Infomation Tech presentation.pptx
PDF
2025 Textile ERP Trends: SAP, Odoo & Oracle
PDF
How Creative Agencies Leverage Project Management Software.pdf
PDF
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
PDF
top salesforce developer skills in 2025.pdf
PPTX
Operating system designcfffgfgggggggvggggggggg
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
Nekopoi APK 2025 free lastest update
Transform Your Business with a Software ERP System
System and Network Administration Chapter 2
ai tools demonstartion for schools and inter college
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
Which alternative to Crystal Reports is best for small or large businesses.pdf
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
Digital Strategies for Manufacturing Companies
Wondershare Filmora 15 Crack With Activation Key [2025
Odoo Companies in India – Driving Business Transformation.pdf
Softaken Excel to vCard Converter Software.pdf
CHAPTER 2 - PM Management and IT Context
Upgrade and Innovation Strategies for SAP ERP Customers
Essential Infomation Tech presentation.pptx
2025 Textile ERP Trends: SAP, Odoo & Oracle
How Creative Agencies Leverage Project Management Software.pdf
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
top salesforce developer skills in 2025.pdf
Operating system designcfffgfgggggggvggggggggg

Linux for programmers

  • 1. Linux for Programmers Md. Al-Amin opu Programmer and *nix user
  • 2. Essential tools gedit Sublime Text
  • 3. Installing gedit sudo apt-get install gedit
  • 4. Installing Sublime Text 1. sudo add-apt-repository ppa:webupd8team/sublime-text-3 2. sudo apt-get update 3. sudo apt-get install sublime-text-installer OR Download .deb file http://www.sublimetext.com/3
  • 5. Setting up environment cd ~/ mkdir programming cd programming mkdir cprogram mkdir cppprogram mkdir python mkdir php
  • 7. Installing C/C++ compiler C compiler comes with default packages in Ubuntu/Mint We need to install C++ compiler for programming in C++ sudo apt-get install build-essential sudo apt-get install g++
  • 8. Creating a new file/ c program Go to your home folder cd ~/ Then go to your “cprogram” folder cd programming cd cprogram Create a new file or c program nano hello.c OR gedit hello.c
  • 9. View the content of file cat filename cat hello.c
  • 10. Compile and debug c program Compiling without flags gcc hello.c -o helloWorld Compiling with flags gcc -Wall -W -Werror hello.c -o HelloWorld Run program ./HelloWorld
  • 11. Creating a c++ program Go to your home folder cd ~/ Then go to your “cprogram” folder cd programming cd cppprogram Create a new file or c program nano new.cpp OR gedit new.cpp
  • 12. Compile and debug c++ program Compiling without flags g++ new.cpp -o NewWorld Compiling with flags g++ -Wall -W -Werror new.cpp -o NewWorld Run program ./NewWorld
  • 14. Python Interpreter Python comes with build in package in Ubuntu/Mint Check python is installed or not python –version If not, install python using following command sudo apt-get install python Run python interpreter using python Type print “Hello World”
  • 15. Run Python from a separate file cd ~/ cd programming cd python Creating a new python program nano hello.py OR gedit hello.py
  • 16. Things to Remember Add this line to indicate python interpreter #! /usr/bin/python Give proper permission to the file chmod a+x hello.py u stands for user. g stands for group. o stands for others. a stands for all. x stand for execute r stand for read w stand for right
  • 17. More about permission # Permission rwx 7 read, write and execute 111 6 read and write 110 5 read and execute 101 4 read only 100 3 write and execute 011 2 write only 010 1 execute only 001 0 none 000 To know more visit: http://en.wikipedia.org/wiki/Chmod
  • 18. Ah!!! Lets run now To run python program python hello.py
  • 20. LAMP Stack LAMP stands for L=Linux , A = Apache , M=MySQL P=PHP Alternative of LAMP is LEMP L= Linux , E= nginx (Engine X) , M= MySQL, P=PHP
  • 21. Setting up Apache Server Update software package source sudo apt-get update Installing apache2 sudo apt-get install apache2 Testing Web Server http://localhost Web Server default folder /var/www/html
  • 22. Install and Configure MySQL First we need to install MySQL Server sudo apt-get install mysql-server Configure MySQL server mysql_secure_installation
  • 23. Creating database and user First login to mysql mysql -u root -p // root is default user. To create a database create database lollipop; // 'lolipop' is our database name To create user and give permission grant all on lollipop.* to 'candy' identified by '5t1ck'; // 'candy' is username. '5t1ck' is password Update privileges flush privileges; To know more about MySQL CLI : http://dev.mysql.com/doc/refman/5.6/en/mysql.html
  • 24. Installing PHP and helper package Installing PHP5 sudo apt-get install php5 Lib-apache module for php5 sudo apt-get install libapache2-mod-php5 To connect mysql with php sudo apt-get install php5-mysql GD module for php sudo apt-get install php5-gd PHP CLI sudo apt-get install php5-cli
  • 25. Creating and Running PHP file Go to web server folder cd /var/www/html Create a new file nano info.php or gedit info.php Inside the file , paste this code <?php phpinfo(); ?> Run the file from your browser http://localhost/info.php
  • 26. Change apache, PHP, MySQL configuration To change apache configuration sudo gedit /etc/apach2/apache2.conf To change PHP configuration sudo gedit /etc/php5/apache2/php.ini To change MySQL configuration sudo gedit /etc/mysql/my.cnf
  • 27. Changing Web Server Server Directory Edit apache2 config file sudo gedit /etc/apach2/apache2.conf Change directory to your own directory <Directory /home/programming/php/> Options Indexes FollowSymLinks AllowOverride All Require all granted </Directory> <Directory /var/www/> Options Indexes FollowSymLinks AllowOverride All Require all granted </Directory>
  • 28. Restarting apache Server If we make any change on the server configuration, always need to restart the server To restart apache server sudo service apache2 restart
  • 29. Installing phpmyadmin To install sudo apt-get install phpmyadmin It should automatically configure the phpmyadmin. Can be run through http://localhost/phpmyadmin If you need to re-cofigure phpmyadmin run sudo dpkg-reconfigure -plow phpmyadmin Then edit apache config file and add this line add the end of that file. Include /etc/phpmyadmin/apache.conf Restart web server
  • 31. Creating Virtual Host Go to apache sites-available directory cd /etc/apache2/sites-available/ Create a new file sudo gedit dev.conf Paste this code on the file <VirtualHost *:80> ServerAdmin webmaster@local.dev ServerName local.dev ServerAlias www.local.dev DocumentRoot /home/programming/php/dev/ ErrorLog /home/programming/php/dev/error.log </VirtualHost>
  • 32. Configure Virtual host cd ~/ cd programming cd php mkdir dev chown -R user:user dev chmod 755 -R dev
  • 33. Enable and Run Virtual host To enable virtual host sudo a2ensite dev.conf Edit host file to assign local IP (Option) sudo gedit /etc/hosts Restart apache sudo service apache2 restart To run newly created host http://local.dev
  • 35. Login Via SSH ssh user@hostname Example : ssh root@23.95.55.245 To logout use exit or logout