Jump to content
xisto Community

Ahsaniqbalkmc

Members
  • Content Count

    800
  • Joined

  • Last visited

  • Days Won

    2

Ahsaniqbalkmc last won the day on June 20 2014

Ahsaniqbalkmc had the most liked content!

1 Follower

About Ahsaniqbalkmc

  • Rank
    Privileged Member
  • Birthday 04/09/1991

Profile Information

  • Gender
    Male
  • Location
    Pakistan
  • Interests
    Anatomy
    Physiology
    Google
    Money
    Cricket
  1. Nice tutorial @yordan....How would you compare this with Oracle virtual box.... I mean it is more commonly used and there is more active developement as well as user support..... Are there any performance, usability differences ????
  2. This really explains the difference.... (y)
  3. Every website developer needs to do some basic tasks related to web-development. Among the important ones is looking for new ways to improve website's user experience as well as keeping it secure with the latest updates and patches. And all this needs to be done without affecting the availability of the website for a single minute. That is why, most web developers like to create local test labs that mimic their online websites and in this way they can test new stuff in their local labs without affecting the availability of the website to the general public. In this post, I will talk about creating local wordpress lab that will be very handy for web developers who use wordpress platform (the most famous framework for websites and blogs).. The main reason for me to create such a lab was to work on my current wordpress theme, which because of some obscure reason was having difficulties with the latest wordpress platform update. With such a local environment, I was able to workout a method whereby I got to keep my theme as well as update to the latest wordpress version, and all this without affecting the availability of my website for a single minute. Different ways to create a local wordpress lab: There are a number of different ways to create a local wrodpress lab (and almost all of them are well-documented online).. However, I personally felt that the lab should be as similar to the actual website as possible, not only in terms of look and feel but also other ways such as how I connect to my website, how I access different files and folders, how I edit them etc. In short, I wanted my lab to behave in such a way that it feels as if I am working on my real website. Local installation of wordpress can be done in different ways. The most common method is to install and setup apache, php, mysql ect on your local machine and then use these services to run wordpress. This method can be simplified by installing WAMP (a package containing Apache, Mysql, Php together, making the installation and configuration easy) on windows or LAMP on linux. Another method of a local wordpress installation is using a package called “InstantWP”. It is also a modification of the above method but is made in such a way that installation and setting up is as painless as few mouse clicks. Furthermore, it also gives you a nice interface for doing different tasks easily. Another method, which is not as simple as those described above, is using a virtual machine to create a server which would then host the local wordpress website. I would like to emphasise again that for most users, setting up such a lab will not be the easiest of tasks. However, this is the method I like the most and in this tutorial I have described in detail how to create such a lab. There are two main reasons why I like this method the most: 1. The main operating system which I use for my normal work is affected minimally by this method (I need only to install Virtual box or Vmware). And thus the need to turn my main OS into a server is avoided. It also provides a sandboxed environment where if something goes wrong, can be corrected easily and even can be reset without affecting the main OS. Thus my main OS remains clean and stable and I can work without worries of damaging it. 2. The second reason is that by creating a local lab using virtual server, I am able to mimic the actual experience of working on my real website as closely as possible. I normally access my website via FTP, and this is how I would be doing it in my local lab. Furthermore, I can also create a cPanel for this local website similar to the actual website, which makes it feel like I am working on my real website. And it really feels good. So I wouldn't mind doing some extra work in the beginning to have a better experience in the longer run... Setting up a virtual server: The first thing that needs to be done to setup our lab is to create a virtual server and for this we first need to create a virtual machine. Two most commonly used applications for creating virtual machines are Oracle Virtual Box and VMware workstation. The first one is Open Source and the second is commercial but a bit more polished, but both work fine. I personally use VMware, but the steps are similar for both applications. Before creating a virtual machine, you need to decide which OS to use for your server. There are many choices, but for me Ubuntu server is the winner. It is free and does a great job and also has a huge database of support available for it. So go ahead and download Ubuntu server 12.04 LTS … I won't go into the details of how to create a virtual machine and install an OS onto it but I must say that the overall process is very simple (maybe I shall write another tutorial for this). You just need to follow the prompts. One point specific to the ubuntu server installation is that during installation it will ask for which services you need to install. For our needs, we just need the ubuntu basic server, SSH server and LAMP server. However, if you miss it during installation, you can do it later.... No worries One thing that need to be understood here is that ubuntu server (and many other pure server linux distros) don't have a graphical interface by default. i.e. you are just presented with a black command line screen and you have to do all your work via this command line interface. Graphical interface (Desktop) can be installed, rather easily, but I would advise against it because it is resource intensive and won't be of much use for a server. First thing's First: Update and Upgrade: After the installation is complete, the first thing you need to do is update the system.. Use the following commands: sudo apt-get updateand then sudo apt-get dist-upgradeThis will make sure that you have the latest and greatest services running. Firewall: After updating your server, make sure that the firewall is enabled. Issue the following command: sudo ufw enableAnd then make sure that firewall is allowing HTTP (port 80) and SSH (port 22) traffic. Use the following commands: sudo ufw allow 80sudo ufw allow 22 Required Services: Once the firewall is ready and configured, we need to make sure that require server services are installed. Use the following command: sudo taskselYou will be greeted with a prompt similar to following picture Make sure that “Basic Ubuntu Server”, “OpenSSH Server”, and “LAMP Server” are installed. The Basic Ubuntu Server and LAMP server are for the normal server functionality needed to host our wordpress website. The OpenSSH server is to make accessing the server easier. It enables us to use services like SSH (to directly commnicate with the server) and FTP (for file transfer). Connect to your virtual machine over SSH: There are two main reasons for using SSH. First one is to safely communicate with your server without the need of opening the virtual machine again and again i.e. the vitual machine can run silently in the background and to communicate with it, you would just need to use an SSH client (e.g. Putty). The second reason is to make our FTP secure. FTP is inherently insecure but by using FTP over SSH, we can create a secure way to use this protocol. To connect over SSH, we will use Putty. To establish a connection, you just need to know the IP address of the virtual machine, which you can easily get by command: ifconfigOnce you get the IP address (mine was: 192.168.188.120) you just provide it into putty and then login using the username and password of your virtual machine... Connect via FTP: FTP is a great way of connecting to a server for uploading and downloading files. For this tutorial, we will use Filezilla FTP client. So open up FileZilla and just provide the information it requires i.e. host: IP address of your virtual machine (in my case: 192.168.188.120) Username: username of your virtual machine user Password: Password of the user Port: Since we will be connecting over secure SSH port so use 22 After you click quick connect, the connection will be established. However there is one issue. The default directory to which FTP connects is “/home/username” however, the files for web browser (port 80) are in “/var/www”. So we need to create a symbolic link to /var/www folder in our /home/username folder so that we can easily access the files for our website. To do this issue the following command: sudo ln -s /var/www /home/pseudo/www(pseudo is my username) Now when you look at filezilla, there would be www shortcut visible... this is where we will place our wordpress files. Download wordpress: Next thing you need to do is download latest wordpress from wordpress.org. Once, downloaded, you need to extract the contents from the zip file into a folder. Change ownership of /var/www folder: To be able to edit the contents of /var/www folder on your server via FTP, you need to change the ownership of this folder and assign it to the user whose credentials are used for logging in via FTP. Normally, this folder belongs to the root user and even a normal user cannot edit its contents directly (i.e. without sudo). But in our case we need our user (“pseudo” in my case) to be able to add and delete files to this folder and also edit the files so that we can do this via FTP.. To change the ownership, use the following command: sudo chown user-name:user-name /var/wwwReplace user-name with your actual user name (I replaced it with pseudo: sudo chown pseudo:pseudo /var/www Upload wordpress files to your virtual server: Connect to your server via Filezilla and open the “www” directory. Make sure that you have deleted the “index.html” file in /var/www. Then upload all the contents of the wordpress folder to /var/www. Check via Browser: Then open up your browser and navigate to the IP address of your virtual server. In my case it was 192.168.188.120 … If everything has gone well, you will be welcomed by wordpress welcome screen. <a href='http://postimage.org/'target='_blank'> <img src='http://s6.postimg.org/yungr6oct/wordpress_welcome_screen.jpg'border='0' alt="wordpress welcome screen" /></a> Once you see this welcome message, you know that everything uptil now has worked fine. Create mysql databse for your wordpress website: Next thing we need to do is create a mysql database and user for our wordpress website.. Use the following commands: sudo su (this will change your prompt to root, so that you can access mysql) mysql -p (this will ask you for a password. Enter the password you used while installing mysql (in LAMP package)) CREATE USER 'wordpress'@'localhost' IDENTIFIED BY 'wordpress';SET PASSWORD FOR 'wordpress'@'localhost' = PASSWORD('yourpassword');CREATE DATABASE wordpress;GRANT ALL PRIVILEGES ON wordpress.* to wordpress@localhost;quitThis will create a user "wordpress", then set password for this user and then create a database. In the last it grants all the required privileges to this user. Start the wordpress installation in your browser: Once you have created the database, enter the IP address of your virtual machine in the browser once again. Then start the wordpress installation. First it will ask you for the datase name, user name, password, and database host etc. Enter the information and click submit Usually, this would create the config file for you but sometimes things might not go as expected and the file may not be created automatically. In such a case, you will be presented with a page as shown below: You just need to create a file named “wp-config.php” and copy the code presented in the page (as in picture above) into the file. Place this file with the rest of the files (i.e. where you have put wordpress files on your virtual server). Then click “Run the Install” After this you will be presented with another welcome screen, where you need to provide information about your local wordpress website. Enter the required information and click “Install wordpress” If everything goes right, you will be presented with a success message. Then login to the website using the credentials you provided earlier and you will be presented the dashboard of your local wordpress website... thats it... Extra tip: To access your website, you need to provide the IP address of your virtual server, which is kind of ugly and inefficient. This can be made very attractive and efficient. You just need to edit the following file: C:\Windows\System32\drivers\etc\hosts Add the following line at the bottom of the file: 192.168.188.120 mylab (Note: I have used 192.168.188.130 in the picture shown.. don't be confused, just use your virtual machine's IP address) and then save it... Next time you just enter “mylab” into the address bar of your browser, you will be able to see your local wordpress website.. Great !!! What we achieved: After all this hassle, we created ourselves a greate testing environment. We created a local wordpress website that behaves just as our orginal website on the internet. It is hosted on a separate server and we can play with it as much as we like without the worry of damaging our working computer. Disclaimer: I have personally created this tutorial while actually following each step as mentioned. And I confirm that it is 100% working. If there is any mistake in this tutorial (due to some typing error etc) please let me know.... Suggestions on how to improve it are also welcome... Thanks...
  4. Filezilla has also a nice FTP server.... How would you compare babyFTP with Filezilla.. And one more thing: I have read on a number of places that FTP is not a secure way of sharing files... Can you elaborate this a bit and and if this is true, what would be a secure way..??
  5. I am not a big fan of web-based OSs... The reason is that here we still use GPRS (no 3G or 4G) so most of the time you are offline... So for us the OS which has most features available offline is the best one. The beauty of android (and for that matter Ios) is that they are as functional online as they are offline.... and that is why I like them both (android more so because of it is open-ness)...
  6. On my HP laptop, there was an option in the BIOS to modify the function of the F... keys. You can set it to work for system tasks like reduce brightness etc (all without simultaneously pressing the "fn" key). In this mode, if you wanted to press, for example, F2 (to rename a file), you had to press the "fn" key and then press F2... I am not sure I understood the OP correctly, but anyway I still thought it might help...
  7. Thanks for reviewing and approving it on such a short notice.....
  8. There are literally hundreds of fun and useful things that you can do with your raspberry pi. Recently, I felt the need for an extra wifi router that can give me more control over who uses my network, in what way they use it and know what happens on it. My existing router (TP LINK TL-WR740N is doing a tremendous job and it has a great set of options to control who is allowed on the network and who is not. However, it lacks some advanced controlling options and has literally no monitoring features. (I don't blame TP Link for that as the device is not meant for that) So, as always, I used the service of master Google to find out what possible options I have here. Within a couple of minutes, I got to know that a linux machine can be configured to be used as a router (both wired and wifi). And as soon as I saw the term "A linux Machine", my sweet little PI came into my mind........ At the time I didn't search further to know how to get the control and monitoring features I desire because I know in my stomach that if its a linux machine, you can do a hell lot of stuff with it... So first thing is first..... The raspberry pi needs to be turned into a wifi router before I can dig further for the controlling and monitoring features... So let’s do it… Requirements: To make a raspberry pi (or any other linux machine) work like a wifi router, the followings things are required: Working Raspberry Pi (using Raspbian Wheezy OS) USB WIFI adapter that supports Access-Point mode Connection to the internet via ethernet or some other network interface (other than the USB WIFI adapter used for Access Point mode) Some time to learn and implement… The theory: The theory behind converting a raspberry pi or some other linux machine into a wifi router consists of three major components. Access Point Mode DHCP Server Forwarding Access Point Mode: Access Point Mode means that the wifi interface on the raspberry pi would serve as an Access Point to which other computers could connect via their wifi. This is in contrast to a normal scenario where wifi is used to connect to other access points. People using “CONNECTIFY” on windows and “PORTABLE HOTSPOT” on android phones would be quite familiar with this feature. For the wifi interface to work as an access point, it is necessary that the WIFI Hardware supports this feature. This point is especially important for the raspberry pi because there is no built in wifi interface. A USB WIFI adapter is needed which comes in different models and with different features. So if you plan to buy a USB WIFI adapter and there is a chance that you would be requiring Access Point mode, make sure that the adapter you are buying supports it. DHCP server: Every computer that connects to the router needs to be assigned a separate IP address so that many computers can simultaneously use the router without hassle. And this is where the DHCP server comes into action. The process of giving different IP to every connecting computer can also be done manually but it then becomes a tedious job and there is no wisdom in doing it manually. Forwarding: Forwarding means that the Raspberry pi should be able to Forward all traffic that comes to it but which is not meant for itself i.e. when the raspberry pi would function as a router, other computers would connect to it mostly for the purpose of getting access to the internet. So the pi should be able to forward the request of these computers to the actual router (connected to the broadband line). Get your hands dirty: The practical process of converting the raspberry pi into a wifi router is rather easy, but you still need to perform some basic linux tasks (and this is where a basic linux knowledge will help). So let’s get our hands dirty. Note: For this tutorial, I connected to my raspberry pi via SSH (putty). Someone with direct access to the raspberry pi (i.e. Pi with Monitor, keyboard and Mouse attached) will have to first open a terminal window and then enter the commands there… Setting up the environment: After turning on the raspberry pi, and connecting to it via SSH (or opening a terminal windows), first thing that needs to be made sure of is that the OS is up-to –date. For this use the following commands: sudo apt-get update And then: sudo apt-get upgrade Installing the necessary software: After the Pi is updated, we need to install “Hostapd” and “Isc-dhcp-Server”. Use the following command to install these software: sudo apt-get install hostapd isc-dhcp-server After the installation of the above tools is complete, turn off your raspberry pi by issuing the following command: sudo shutdown –h now When the Pi is turned off, insert the USB-WIFI adapter and turn on the pi (by plugging the USB cable out and then back in) One the pi has booted up, issue the following command to see whether the Wlan0 interface is working or not: iwconfig The wlan0 interface should be present and displaying information about the wireless configuration of the device (the configurations are not important, its just that they should be visible as a sign that the interface is working correctly) Set up the DHCP server: We installed the isc-dhcp-server for our DHCP needs, but before it can work as desired, we need to modify the configuration file so that the WIFI connections would automatically be assigned unique IP addresses and DNS etc. To edit the configuration file, enter the following command: sudo nano /etc/dhcp/dhcpd.conf (nano is command-line based text editor and “/etc/dhcp/dhcpd.conf” is the location of the configuration file) Once the file is opened in nano, find the following lines: option domain-name "example.org"; option domain-name-servers ns1.example.org, ns2.example.org; and change them to: #option domain-name "example.org"; #option domain-name-servers ns1.example.org, ns2.example.org; (i.e. comment them out as they are not needed) Then find the following line: #authoritative; and change it to: authoritative; (i.e. remove the commenting sing # as this command would be needed) Then scroll down to the bottom and add the following lines; subnet 192.168.42.0 netmask 255.255.255.0 { range 192.168.42.10 192.168.42.50; option broadcast-address 192.168.42.255; option routers 192.168.42.1; default-lease-time 600; max-lease-time 7200; option domain-name "local"; option domain-name-servers 8.8.8.8, 8.8.4.4; } (these will be the settings of our DHCP server) Save the configuration file by pressing Ctrl+X, then Y and then Enter Next, we need to make changes to /etc/default/isc-dhcp-server file. So enter the following command: sudo nano /etc/default/isc-dhcp-server and change INTERFACES=”” to INTERFACES=”wlan0” Set up static IP for wlan0: For the DHCP server to function normally, we need to make sure that our wlan0 has a static IP address. First make sure that wlan0 interface is down: sudo ifdown wlan0 Next, we need to edit the file /etc/network/interfaces: sudo nano /etc/ network/interfaces Find the line auto wlan0 and add a # in front of the line (comment it out), and in front of every line afterwards. If you don't have that line, its fine. Next, find the line allow-hotplug wlan0 and add the following lines below it; iface wlan0 inet static address 192.168.42.1 netmask 255.255.255.0 Comment out the remaining lines below (by adding # in the start) and save the file. Next assign the static IP to the wifi adapter by entering the following command: sudo ifconfig wlan0 192.168.42.1 Configure Hostapd: Next, we need to configure hostapd, so that our wifi access point is just like we want it to be. For this, create a new file /etc/hostapd/hostapd.conf by entering the following command: sudo nano /etc/hostapd/hostapd.conf Add the following to this new file: interface=wlan0driver=nl80211ssid=my-wifihw_mode=gchannel=6macaddr_acl=0auth_algs=1ignore_broadcast_ssid=0wpa=2wpa_passphrase=my-passwordwpa_key_mgmt=WPA-PSKwpa_pairwise=TKIPrsn_pairwise=CCMP A few things are important to understand here. If you are using Adafruit wifi adapters, the driver would be rtl871xdrv. But for most other adapters, the driver is nl80211. So you need to modify that line according to the wifi adapter you are using. Second thing is that SSID is the name of your wifi network and wpa_passphrase is its password. So change them as you like. (Make sure that the password is at least 8 characters long Next thing we need to do is tell hostapd where the configuration file is. So enter the following command: sudo nano /etc/default/hostapd and then change the line #DAEMON_CONF=”” to DAEMON_CONF=”/etc/hostapd/hostapd.conf” (the comment sign is also removed) Configure the IP tables: Here we are going to set the configurations required for proper forwarding: Enter the following command: sudo nano /etc/ sysctl.conf On the bottom of this file, add the following line: net.ipv4.ip_forward=1 This will make sure that forwarding starts working next time you bootup. Next, we need to modify the iptables to create network translation between ethernet interface (the connection to the internet) and the wlan0 interface (the connection to other devices). Enter the following commands sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE sudo iptables -A FORWARD -i eth0 -o wlan0 -m state --state RELATED,ESTABLISHED -j ACCEPT sudo iptables -A FORWARD -i wlan0 -o eth0 -j ACCEPT To make these changes permanent, (i.e. you don’t have to type the above commands every time you reboot), enter the following command: sudo sh -c "iptables-save > /etc/iptables.ipv4.nat" Enter the following command to make the changes take effect immediately: sudo sh -c "iptables-save > /etc/iptables.ipv4.nat" And then edit the file /etc/network/interfaces (command: sudo nano /etc/network/interfaces) and add the following line at the bottom: up iptables-restore < /etc/iptables.ipv4.nat Update Hostapd to the newest version: The version of hostapd that is intalled by default is 1.0 however the newest version is 2.0. The newer version has better support for wifi adapters so we need to upgrade it. First download the following file: http://w1.fi/releases/hostapd-2.0.tar.gz (you can download the file directly to the PI using command wget http://w1.fi/releases/hostapd-2.0.tar.gz) Then extract it using command: tar xzvf hostapd-2.0.tar.gz Change the directory to hostapd-2.0/hostapd/ (command: cd hostapd-2.0/hostapd) Next, copy the defconfig file as .config (command: cp defconfig .config) And then open the file in nano (command: sudo nano .config) and remove the comment (#) from line #CONFIG_DRIVER_NL80211=y Next, compile hostapd (command: make) [NOTE: Before compiling, make sure that you have the following packages installed, otherwise you are going to get a lot of errors libssl-dev, libnl1, libnl-dev (command: sudo apt-get install libssl-dev libnl1 libnl-dev) ] After compilation is complete, run the following commands to replace the older version of hostapd: sudo mv /usr/sbin/hostapd usr/sbin/hostapd.ORIG (renames the old version as hostapd.ORIG) sudo mv hostapd /usr/sbin/hostapd sudo chmod 755 /usr/sbin/hostapd (make necessary changes to permissions) First Test: Its time we test our WIFI access point. Run the following command: sudo /usr/sbin/hostapd /etc/hostapd/hostapd.conf Hurrey….. The Raspbery Pi wifi Access Point is up and running (I have written this tutorial simultaneously with setting up a wifi AP on my own PI and I confirm that it is perfectly working. So if you are getting any errors, please make sure that you have performed each step correctly).
  9. Wow! seems very interesting... But in my previous post, I wanted to compare gaming on a linux PC and Gaming on a windows PC (the emphasis being on PC). Dedicated consoles are good but they are more commonly used by gamers who take their gaming seriously (at least in my country).. Normally people use their PC for occasional gaming. And it is these people that make the masses. So if a common Linux OS (say ubuntu) somehow get the same gaming support as Windows, then I am pretty sure that Linux will see many new Users..
  10. Ahh... I wish I could pay Xisto by means other than myCENTS... Its so miserable for me that I can afford to pay for a better service for my website but I don't have the means required.... myCENTS system is super cool (because it was only for this system that I was able to create a website and earn money from it) but it is difficult to make large payments especially when one is busy with his offline (real) life.....
  11. Maybe its time Xisto Forums provide this feature of hosting images on their own servers... I will surely help polish the great tutorials like this one...
  12. If gaming comes to linux then windows is surely doomed... Especially with the appearance of Distros like Ubuntu 13 and Linux Mint 15 which are so easy to use, Linux will surely get into the mainstream... And all the monoply of the big tech giants going on in the background, I don't think gamin is going to be good on linux anytime soon...
  13. Cartridges are expensive here.. Sometimes to the point that it is better to buy a new printer rather than a replacement cartridge.. And this is the reason I am currently sticking to my current faulty cartridge... When it damages to a point that it can no longer be used, I would be tempred to buy a new printer rather than replacing it....
  14. marketing appears to be the real culprit... Networking can also be a reason but the differences are a bit too significant (apparantly) for networking reason to be true.. For instance, the Samsung Galaxy S III has an internation version with quad core processor and and 1 gig of ram and there was another version (don't remember exactly which one) with a dual core processor and 2 gigs of ram... To add to this idea, there are often differences like Camera Megapixels (which are not likely to be related to the network differences)... What annoys me most is that most often, the custome ROMs (like those on XDA) are not available for some versions of the same phone (for instance International LG optimus G has a lot of support from the XDA developers but the Korean version is left like an orphan)... So if you have a non-international version of a phone, it is very likely that you wouldn't be able to enjoy all the Custom stuff that makes android so awesome...
×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.