Minggu, 05 Agustus 2018

instal radius desk ubuntu 18


Install Nginx

  • We assume you have a clean install of Ubuntu 16.04 WITHOUT Apache installed.
  • To remove Apache
   sudo systemctl start apache2.service
   sudo apt-get remove apache2
  • Ensure the English language pack is installed
sudo apt-get install language-pack-en-base
  • Install Nginx
sudo apt-get install nginx
  • Ensure the web server starts up and is running
sudo systemctl stop nginx.service
sudo systemctl start nginx.service
  • Navigate to the IP Address of the server where you installed Nginx using a browser to ensure Nginx serves content e.g.
  • The default directory where Nginx serves its content from on Ubuntu is /var/www/html.
  • Since RADIUSdesk has been developed over a couple of years, it was traditionally served by Nginx from the /usr/share/nginx/html directory. (This was on Ubunut 14.04).
  • Edit the default server file:
 sudo vi /etc/nginx/sites-enabled/default
  • Change the value of root:
#root /var/www/html;
root /usr/share/nginx/html;

Configure Nginx to interpret .php files


  • The default install of Nginx does not support the serving of .php files.
  • We will install a program (actually a service) called php-fpm.
  • This service will listen for requests to interpret.
  • Install the php-fpm service:
sudo apt-get install php-fpm

Modify Nginx

  • Now that the php-fpm service is installed we should change the default Nginx server to make use of it.
  • Edit the default server file:
    sudo vi /etc/nginx/sites-enabled/default
  • Add index.php to this line:
    #add index.php
    index index.php index.html index.htm;
  • Activate PHP precessing by uncommenting this this section. Note that we use the UNIX socket:
    # pass the PHP scripts to FastCGI server listening on
    location ~ \.php$ {
                include snippets/fastcgi-php.conf;
        #       # With php7.0-cgi alone:
        #       fastcgi_pass;
        #       # With php7.0-fpm:
                fastcgi_pass unix:/run/php/php7.2-fpm.sock;
  • Enable the hiding of .htaccess files
    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    location ~ /\.ht {
        deny all;
  • Reload the Nginx web server's configuration
sudo systemctl reload nginx.service
  • Create a test .php file to confirm that it does work
sudo vi /usr/share/nginx/html/test.php
  • Contents:

Install MySQL

  • Be sure to supply a root password for the MySQL database when asked for it if you are security conscious else simply hit the ESC key.
sudo apt-get install mysql-server php-mysql

Disable strict mode

  • With the 16.04 release of MySQL there were some changes to the MySQL configuration which causes problems on the current RADIUSdesk database implementation.
  • We will disable Strict SQL Mode in MySQL 5.7.
sudo vi /etc/mysql/conf.d/disable_strict_mode.cnf
  • Enter these two lines:
  • Save the file and restart the MySQL service
sudo systemctl restart mysql.service

Performance tune Nginx

Modify expiry date for certain files

  • Edit the /etc/nginx/sites-available/default file:
sudo vi /etc/nginx/sites-available/default
  • Add the following inside the server section:
location ~ ^/cake2/.+\.(jpg|jpeg|gif|png|ico|js|css)$ {
    rewrite ^/cake2/rd_cake/webroot/(.*)$ /cake2/rd_cake/webroot/$1 break;
    rewrite ^/cake2/rd_cake/(.*)$ /cake2/rd_cake/webroot/$1 break;
    access_log off;
    expires max;
    add_header Cache-Control public;
  • Reload Nginx:
sudo systemctl reload nginx.service

Compress the text before sending it to client

  • Edit the main config file of Nginx.
sudo vi /etc/nginx/nginx.conf
  • Change the compression section to contain the following:
gzip on;
gzip_disable "msie6";

gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
  • Restart Nginx
sudo systemctl restart nginx.service

Install RADIUSdesk

  • The first part prepared everything to install RADIUSdesk. This part will go through the steps to install the latest RADIUSdesk.
  • RADIUSdesk consists of three components.
    • rd directory with its contents contains all the HTML and JavaScript code and is used as the presentation layer.
    • rd_cake is a CakePHP application and can be considered the engine room. Here the data is processed before being presented by the presentation layer. (We currently use one CakePHP v2 and one CakePHP v3 application in order to migrate from CakePHP v2 to CakePHP v3)
    • rd_login is a directory with various login pages which are centrally managed through the RADIUSdesk Dynamic Login Pages applet. Although this is optional, it is used by most installs.
  • We will use SVN (subversion) to check out the latest version (trunk) of RADIUSdesk.

Install CakePHP

  • As from December 2016 we started a migration process of migrating from CakePHP v2 to CakePHP v3.
  • The ORM component of CakePHP v3 is completely new and different which makes the migration fairly involved.
  • Since the architecture of RADIUSdesk is following modern design principles it allows us to run both CakePHP v2 and CakePHP v3 simultaneously.
  • We can then do the migration gradually over time.
Required packages
  • Make sure the following packages are installed:
sudo apt-get install php-cli php-gd php-curl php-xml php-mbstring php-intl
Install CakePHP v2
  • Download the 2.x version of CakePHP (Version 2.9.7 as of this writing). https://github.com/cakephp/cakephp/tags
  • There are two formats to choose from when selecting to download, Zip or Tar.gz. Select Tar.gz.
  • Copy and extract it inside the directory that Nginx is serving its content from (/usr/share/nginx/html)
sudo cp 2.9.7.tar.gz /usr/share/nginx/html
cd /usr/share/nginx/html
sudo tar -xzvf 2.9.7.tar.gz 
sudo ln -s ./cakephp-2.9.7 ./cake2
  • Reload php7.0-fpm
sudo systemctl reload php7.0-fpm.service
Install the RADIUSdesk CakePHP v2 Application
  • Install subversion in order for you to check out the latest source for RADIUSdesk.
sudo apt-get install subversion
  • Check out the rd_cake branch from trunk to /usr/share/nginx/html.
cd /usr/share/nginx/html/cake2
sudo svn checkout svn://dvdwalt@svn.code.sf.net/p/radiusdesk/code/trunk/rd_cake ./rd_cake
  • Change the following directories to be writable by www-data:
sudo chown -R www-data. /usr/share/nginx/html/cake2/rd_cake/tmp
sudo chown -R www-data. /usr/share/nginx/html/cake2/rd_cake/Locale
sudo chown -R www-data. /usr/share/nginx/html/cake2/rd_cake/webroot/img/flags
sudo chown -R www-data. /usr/share/nginx/html/cake2/rd_cake/webroot/img/nas
sudo chown -R www-data. /usr/share/nginx/html/cake2/rd_cake/webroot/img/realms
sudo chown -R www-data. /usr/share/nginx/html/cake2/rd_cake/webroot/img/dynamic_details
sudo chown -R www-data. /usr/share/nginx/html/cake2/rd_cake/webroot/img/dynamic_photos
sudo chown -R www-data. /usr/share/nginx/html/cake2/rd_cake/webroot/files/imagecache
Install the RADIUSdesk CakePHP v3 Application
  • Check out the cake3 branch from trunk to /usr/share/nginx/html.
cd /usr/share/nginx/html/
sudo svn checkout svn://dvdwalt@svn.code.sf.net/p/radiusdesk/code/trunk/cake3 ./cake3
  • Change the following directories to be writable by www-data:
sudo chown -R www-data. /usr/share/nginx/html/cake3/rd_cake/tmp
sudo chown -R www-data. /usr/share/nginx/html/cake3/rd_cake/logs
sudo chown -R www-data. /usr/share/nginx/html/cake3/rd_cake/webroot/img/realms
sudo chown -R www-data. /usr/share/nginx/html/cake3/rd_cake/webroot/img/dynamic_details
sudo chown -R www-data. /usr/share/nginx/html/cake3/rd_cake/webroot/img/dynamic_photos
sudo chown -R www-data. /usr/share/nginx/html/cake3/rd_cake/webroot/img/access_providers
sudo chown -R www-data. /usr/share/nginx/html/cake3/rd_cake/webroot/files/imagecache

The Database

  • Create the following blank database:
sudo su
mysql -u root
create database rd;
GRANT ALL PRIVILEGES ON rd.* to 'rd'@'localhost' IDENTIFIED BY 'rd';
  • Populate the database (trunk):
    sudo mysql -u root rd < /usr/share/nginx/html/cake3/rd_cake/setup/db/rd.sql
  • If you have a small server like a Raspberry Pi you, run the following SQL for better performance.
USE rd;
DELETE FROM phrase_values WHERE language_id=16 OR language_id=15 OR language_id=13 OR language_id=5 OR language_id=14;

Configure Nginx

  • Since CakePHP uses rewrite rules, we have to configure Nginx in such a way as to allow rewriting of the URL's that starts with /cake2/rd_cake or with /cake3/rd_cake.
  • Edit /etc/nginx/sites-enabled/default
    sudo vi /etc/nginx/sites-enabled/default
  • Add the following section inside the server section:
location /cake2/rd_cake {
     rewrite ^/cake2/rd_cake/(.*)$ /cake2/rd_cake/webroot/$1 break;
     try_files $uri $uri/ /cake2/rd_cake/webroot/index.php?q=$uri&$args;
location /cake3/rd_cake {
   rewrite ^/cake3/rd_cake(.+)$ /cake3/rd_cake/webroot$1 break;
   try_files $uri $uri/ /cake3/rd_cake/index.php$is_args$args;
  • Reload the Nginx web server:
   sudo systemctl reload nginx.service
  • Congratulations you are almost there. Next we will install the viewer component

Viewer component

  • Check out the latest code of the viewer component under the /usr/share/nginx/html/ directory:
cd /usr/share/nginx/html/
sudo svn checkout svn://dvdwalt@svn.code.sf.net/p/radiusdesk/code/trunk/rd ./rd
  • For the viewer component you need the ExtJS toolkit. We've added version 6.2.0 to the SVN repository for easy download :-)
  • Checkout and unzip the GPL version under the /usr/share/nginx/html/rd directory. NOTE: This is a single big file which will take some time to download over slow connections.
cd /usr/share/nginx/html/
sudo svn checkout svn://svn.code.sf.net/p/radiusdesk/code/extjs ./
sudo mv  ext-6-2-sencha_cmd.tar.gz ./rd
cd /usr/share/nginx/html/rd
sudo tar -xzvf ext-6-2-sencha_cmd.tar.gz

Cron Scripts

  • RADIUSdesk requires a few scripts to run periodically in order to maintain a healthy and working system.
  • To activate the cron scripts execute the following command, which will add RADIUSdesk's crons scripts to the Cron system
sudo cp /usr/share/nginx/html/cake2/rd_cake/Setup/Cron/rd /etc/cron.d/
  • If you want to change the default intervals at which the scripts get executed, just edit the /etc/cron.d/rd file.

Next steps

Rabu, 09 Agustus 2017

Dzikir dan maag

Maag adalah salah satu penyakit berbahaya yang dapat membuat anda merasa kembung dan sering kentut dan perasaan yang tidak enak, ada suatu ketika saya merasa hal tersebut dan membuat saya pusing karena banyaknya Karbon dioksida dalam tubuh dan membuat malas bekerja, ketika saya mulai maag saya mulai membaca dzikir asmaul husna
Ya salam = yang Maha penyelamat
Ya razaq = yang Maha kaya
Ya rahman = yang Maha penyayang
Ya rahim = yang Maha pengasih
Dan shalawat rasul allahuma shali Ala syadina Muhammad wa Ala Ali syadina Muhammad
Membaca Kelimanya berturut2 sebanyak banyaknya, akhirnya rasa kembung maag perlahan2 menghilang dan saya merasa sehari kembali mari kita kembalikan semua kepada Allah sang Maha penyelamat,
Semoga informasi saya berguna untuk Anda karena semuanya berkat pertolongan Allah SWT

Kamis, 13 Juli 2017

Cara memperbaiki keyboard hanya spasi backpace dan enter

Ketika anda mengetik ternyata keyboard anda tidak berfungsi normal? Hanya bisa tekan spasi backpace dan enter cara memperbaikinya sangat mudah, masalah ini terjadi ketika tombol ctrl anda bermasalah, tekan tombol ctrl berkali-kali dan coba angkat biasanya masuk ke dalam, punya saya juga begitu alhamdulillah keyboard kembali normal

Rabu, 28 Juni 2017

Kualitas Pengiriman aliexpress mail vs China mail registered

Ketika anda menggunakan kedua Pengiriman aliexpress mail dan China mail registered mana yang lebih cepat?

Dari pengalaman saya dalam berbelanja aliexpress mail lebih cepat dari China mail registered, kenapa? Karena aliexpress mail menggunakan Singapore mail yang lebih dekat dengan Indonesia sehingga Pengiriman bisa 15 hari sudah sampai sedangkan China mail registered bisa mencapai 24-30 hari, jadi saya saran kan jika anda memilih Pengiriman menggunakan aliexpress mail hanya mahal sedikit dengan China mail registered

Senin, 05 Desember 2016

cara membuat jalan alternative google maps menggunakan javascript

cara membuat jalan alternative google maps menggunakan javascript
    function (response, status) {
        if (status == google.maps.DirectionsStatus.OK) {
            for (var i = 0, len = response.routes.length; i < len; i++) {
                new google.maps.DirectionsRenderer({
                    map: mapObject,
                    directions: response,
                    routeIndex: i
        } else {
            $("#error").append("Unable to retrieve your route<br />");

Senin, 28 November 2016

asynctask google maps pada android

ini adalah snippet pada coding pemanggilan asynctask android maps

public class Request_Update extends AsyncTask<Location, Void, Location>{
 protected void onPreExecute()
  //Toast.makeText(getApplicationContext(), "onPreExecute()!", Toast.LENGTH_SHORT).show();
 protected Location doInBackground(Location... location) {
  // TODO Auto-generated method stub
  String url = "http://maps.googleapis.com/maps/api/directions/xml?" 
    + "origin=" + location[0].getLatitude() + "," + location[0].getLongitude()  
    + "&destination=" + frnd_lat + "," + frnd_longi 
    + "&sensor=false&units=metric&mode="+direction; //direction="walking" or "driving"

  try {
   HttpClient httpClient = new DefaultHttpClient();
   HttpContext localContext = new BasicHttpContext();
   HttpPost httpPost = new HttpPost(url);
   HttpResponse response = httpClient.execute(httpPost, localContext);
   InputStream in = response.getEntity().getContent();
   DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
   doc = builder.parse(in);
  } catch (Exception e) {    
  return location[0];
 protected void onPostExecute(Location location)
   int ii = 0;
   for( ; ii <size_of_latlong ; ii++) {    
     PolylineOptions rectLine = new PolylineOptions().width(8).color(Color.RED);
     Polyline polyline=map.addPolyline(rectLine);
     PolylineOptions rectLine = new PolylineOptions().width(8).color(Color.RED);
     Polyline polyline=map.addPolyline(rectLine);
   PolylineOptions rectLine = new PolylineOptions().width(8).color(Color.RED);
   Polyline polyline=map.addPolyline(rectLine);
public ArrayList<LatLng> getDirection(Document doc) {
 NodeList nl1, nl2, nl3;
 ArrayList<LatLng> listGeopoints = new ArrayList<LatLng>();
 nl1 = doc.getElementsByTagName("step");
 if (nl1.getLength() > 0) {
  for (int i = 0; i < nl1.getLength(); i++) {
   Node node1 = nl1.item(i);
   nl2 = node1.getChildNodes();

   Node locationNode = nl2.item(getNodeIndex(nl2, "start_location"));
   nl3 = locationNode.getChildNodes();
   Node latNode = nl3.item(getNodeIndex(nl3, "lat"));
   double lat = Double.parseDouble(latNode.getTextContent());
   Node lngNode = nl3.item(getNodeIndex(nl3, "lng"));
   double lng = Double.parseDouble(lngNode.getTextContent());
   listGeopoints.add(new LatLng(lat, lng));

   locationNode = nl2.item(getNodeIndex(nl2, "polyline"));
   nl3 = locationNode.getChildNodes();
   latNode = nl3.item(getNodeIndex(nl3, "points"));
   ArrayList<LatLng> arr = decodePoly(latNode.getTextContent());
   for(int j = 0 ; j < arr.size() ; j++) {
    listGeopoints.add(new LatLng(arr.get(j).latitude, arr.get(j).longitude));

   locationNode = nl2.item(getNodeIndex(nl2, "end_location"));
   nl3 = locationNode.getChildNodes();
   latNode = nl3.item(getNodeIndex(nl3, "lat"));
   lat = Double.parseDouble(latNode.getTextContent());
   lngNode = nl3.item(getNodeIndex(nl3, "lng"));
   lng = Double.parseDouble(lngNode.getTextContent());
   listGeopoints.add(new LatLng(lat, lng));
 return listGeopoints;
private int getNodeIndex(NodeList nl, String nodename) {
 for(int i = 0 ; i < nl.getLength() ; i++) {
   return i;
 return -1;
private ArrayList<LatLng> decodePoly(String encoded) {
 ArrayList<LatLng> poly = new ArrayList<LatLng>();
 int index = 0, len = encoded.length();
 int lat = 0, lng = 0;
 while (index < len) {
  int b, shift = 0, result = 0;
  do {
   b = encoded.charAt(index++) - 63;
   result |= (b & 0x1f) << shift;
   shift += 5;
  } while (b >= 0x20);
  int dlat = ((result & 1) != 0 ? ~(result >> 1) : (result >> 1));
  lat += dlat;
  shift = 0;
  result = 0;
  do {
   b = encoded.charAt(index++) - 63;
   result |= (b & 0x1f) << shift;
   shift += 5;
  } while (b >= 0x20);
  int dlng = ((result & 1) != 0 ? ~(result >> 1) : (result >> 1));
  lng += dlng;

  LatLng position = new LatLng((double)lat / 1E5, (double)lng / 1E5);
 return poly;